1. ホーム
  2. vue

ERROR コマンドは失敗しました: npm install --loglevel error --registry=https://registry.npm.taobao.org --di

2022-02-13 05:37:33

vue-cli 3.0 で vue プロジェクトをビルドすると、以下のエラーが発生します。

> [email protected] install C:\vueDemo\myproject\node_modules\chromedriver
> node install.js

Downloading https://chromedriver.storage.googleapis.com/2.41/chromedriver_win32.zip
Saving to C:\Users\13902\AppData\Local\Temp\chromedriver\chromedriver_win32.zip
ChromeDriver installation failed Error with http(s) request: Error: connect ETIMEDOUT 216.58.220.208:443
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node install.js`
Exit status 1
npm ERR!
Failed at the [email protected] install script. npm ERR!
This is probably not a problem with npm. There is likely additional logging output above.

A complete log of this run can be found in:
C:\tool\node_cache\_logs\2018-08-20T02_24_35_243Z-debug.log
 ERROR command failed: npm install --loglevel error --registry=https://registry.npm.taobao.org --disturl=https://npm.taobao.org/dist

回避策:npm install chromedriver --chromedriver_cdnurl=http://cdn.npm.taobao.org/dist/chromedriver

効果は以下の通りです。

C:\vueDemo> npm install chromedriver --chromedriver_cdnurl=http://cdn.npm.taobao.org/dist/chromedriver

> [email protected] install C:\vueDemo\node_modules\chromedriver
> node install.js

Downloading http://cdn.npm.taobao.org/dist/chromedriver/2.41/chromedriver_win32.zip
Saving to C:\Users\13902\AppData\Local\Temp\chromedriver\chromedriver_win32.zip
Received 806K...
Received 1607K...
Received 2394K...
Received 3185K...
Received 3468K total.
Extracting zip contents
Copying to target path C:\vueDemo\node_modules\chromedriver\lib\chromedriver
Done. ChromeDriver binary available at C:\vueDemo\node_modules\chromedriver\lib\chromedriver\chromedriver.exe
npm WARN saveError ENOENT: no such file or directory, open 'C:\vueDemo\package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open 'C:\vueDemo\package.json'
npm WARN vueDemo No description
npm WARN vueDemo No repository field.
npm WARN vueDemo No README data
npm WARN vueDemo No license field.

+ [email protected]
added 91 packages from 70 contributors and audited 130 packages in 15.16s
found 0 vulnerabilities