一、npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/typescript (over 30000ms)


$ vue -V
2.9.6

$ npm uninstall vue-cli -g
removed 239 packages in 8.928s

$ vue -V
bash: /c/Program Files/nodejs/vue: No such file or directory


$ vue --version
bash: /c/Program Files/nodejs/vue: No such file or directory




$ npm install -g @vue/cli
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/typescript (over 30000ms)

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\firesky\AppData\Roaming\npm-cache\_logs\2020-06-04T15_06_15_126Z-debug.log


$ npm config set strict-ssl false

这样就安装成功了!

$ npm install -g @vue/cli
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
C:\Program Files\nodejs\vue -> C:\Program Files\nodejs\node_modules\@vue\cli\bin\vue.js

> core-js@3.6.5 postinstall C:\Program Files\nodejs\node_modules\@vue\cli\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> @apollo/protobufjs@1.0.4 postinstall C:\Program Files\nodejs\node_modules\@vue\cli\node_modules\@apollo\protobufjs
> node scripts/postinstall


> nodemon@1.19.4 postinstall C:\Program Files\nodejs\node_modules\@vue\cli\node_modules\nodemon
> node bin/postinstall || exit 0

Love nodemon? You can now support the project via the open collective:
 > https://opencollective.com/nodemon/donate


> ejs@2.7.4 postinstall C:\Program Files\nodejs\node_modules\@vue\cli\node_modules\ejs
> node ./postinstall.js

Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)

npm WARN jscodeshift@0.9.0 requires a peer of @babel/preset-env@^7.1.6 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\@vue\cli\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ @vue/cli@4.4.1
added 1104 packages from 662 contributors in 197.127s

$ vue --version
@vue/cli 4.4.1


二、npm ERR! EEXIST: file already exists

上面是vue-cli4.x,但是想安装vue-cli3.x。卸载重装

$ npm uninstall -g @vue/cli
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
removed 1104 packages in 17.051s

$ vue --versioon
bash: /c/Program Files/nodejs/vue: No such file or directory
$ npm install -g @vue/cli@3.3.0
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN rollback Rolling back vue-cli-plugin-apollo@0.20.0 failed (this is probably harmless): EPERM: operation not permitted, scandir 'C:\Program Files\nodejs\node_modules\@vue\cli\node_modules'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\@vue\cli\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code EEXIST
npm ERR! path C:\Program Files\nodejs\node_modules\@vue\cli\bin\vue.js
npm ERR! dest C:\Program Files\nodejs\vue
npm ERR! EEXIST: file already exists, cmd shim 'C:\Program Files\nodejs\node_modules\@vue\cli\bin\vue.js' -> 'C:\Program Files\nodejs\vue'
npm ERR! File exists: C:\Program Files\nodejs\vue
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\firesky\AppData\Roaming\npm-cache\_logs\2020-06-04T15_49_43_969Z-debug.log

重点在这个(把提示已存在的相关文件删除掉):

npm ERR! EEXIST: file already exists, cmd shim 'C:\Program Files\nodejs\node_modules\@vue\cli\bin\vue.js' -> 'C:\Program Files\nodejs\vue'
npm ERR! File exists: C:\Program Files\nodejs\vue
npm ERR! Remove the existing file and try again, or run npm

删除后再重新安装即可,如下:

$ npm install -g @vue/cli@3.3.0
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
C:\Program Files\nodejs\vue -> C:\Program Files\nodejs\node_modules\@vue\cli\bin\vue.js

> core-js@3.6.5 postinstall C:\Program Files\nodejs\node_modules\@vue\cli\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> @apollo/protobufjs@1.0.4 postinstall C:\Program Files\nodejs\node_modules\@vue\cli\node_modules\@apollo\protobufjs
> node scripts/postinstall


> nodemon@1.19.4 postinstall C:\Program Files\nodejs\node_modules\@vue\cli\node_modules\nodemon
> node bin/postinstall || exit 0


> ejs@2.7.4 postinstall C:\Program Files\nodejs\node_modules\@vue\cli\node_modules\ejs
> node ./postinstall.js

Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\@vue\cli\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ @vue/cli@3.3.0
added 710 packages from 557 contributors in 128.494s

$ vue -V
3.3.0

Logo

前往低代码交流专区

更多推荐