vue-cli从2升级到3报错error 404 Not Found: @wry/context@^0.4.0

vue3出来了,想尝尝鲜。

于是按官方的方法卸载2安装3.

npm uninstall vue-cli -g


npm install -g @vue/cli

但是报错了 error 404 Not Found: @wry/context@^0.4.0

一脸懵逼。。。

网上搜索之,并没有什么参考资,只得自己一步一步排除。

一,于是检查Node.js版本,推荐 8.11.0+

node -v

没有问题

二,删掉原来node全局配置的vue-cli并使用管理员的cmd

还是存在问题

解决办法: nrm的基本用法

原来我使用了nrm 管理 npm源的问题

设置了 npm 实际是指向了淘宝的

将源改为官方的

重新安装:

npm install -g @vue/cli
D:>nrm use npm


   Registry has been set to: https://registry.npmjs.org/


D:>npm install -g @vue/cli
npm WARN deprecated joi@14.3.1: This module has moved and is now available at @hapi/joi. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm WARN deprecated topo@3.0.3: This module has moved and is now available at @hapi/topo. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm WARN deprecated hoek@6.1.3: This module has moved and is now available at @hapi/hoek. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
D:Program Files
odejs
ode_globalvue -> D:Program Files
odejs
ode_global
ode_modules@vuecliinvue.js

> core-js@3.1.2 postinstall D:Program Files
odejs
ode_global
ode_modules@vuecli
ode_modulescore-js
> node -e "try { require('./scripts/postinstall'); } catch (e) { /* empty */ }"

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

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 -)


> protobufjs@6.8.8 postinstall D:Program Files
odejs
ode_global
ode_modules@vuecli
ode_modulesprotobufjs
> node scripts/postinstall


> nodemon@1.19.0 postinstall D:Program Files
odejs
ode_global
ode_modules@vuecli
ode_modules
odemon
> node bin/postinstall || exit 0

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

npm WARN rollback Rolling back node-pre-gyp@0.12.0 failed (this is probably harmless): EPERM: operation not permitted, lstat 'D:Program Files
odejs
ode_global
ode_modules@vuecli
ode_modulesfsevents
ode_modules'
npm WARN ts-node@8.1.0 requires a peer of typescript@>=2.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules@vuecli
ode_modulesfsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ @vue/cli@3.7.0
added 677 packages from 508 contributors in 79.482s

安装成功。

好记性不如烂笔头,每天记录一点点
原文地址:https://www.cnblogs.com/wayneliu007/p/10919234.html