【发布时间】:2018-09-05 16:22:57
【问题描述】:
我在为项目安装依赖项时看到了这个:
Update available 5.7.1 → 5.8.0 │
│ Run npm i npm to update
然后我这样做了:
$ npm i npm
npm WARN react-hot-api@0.4.7 requires a peer of react@>=0.11.0 || ^0.14.0-rc but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
+ npm@5.8.0
added 523 packages from 726 contributors in 12.75s
可是为什么还是老版本呢?
$ npm --version
5.7.1
【问题讨论】:
-
根据您第一次安装的方式,您应该卸载旧版本并将路径设置为新位置
-
如果你想使用多个nodejs版本,你应该使用nvm
-
或者删除旧版本再安装新版本