nodejs用代码更新版本出现问题

我直接在命令行输入npm install -g n
一直报这种错误

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "n"
npm ERR! node v4.6.1
npm ERR! npm  v2.15.9
npm ERR! code EBADPLATFORM

npm ERR! notsup Unsupported
npm ERR! notsup Not compatible with your operating system or architecture: n@2.1.4
npm ERR! notsup Valid OS:    !win32
npm ERR! notsup Valid Arch:  any
npm ERR! notsup Actual OS:   win32
npm ERR! notsup Actual Arch: x64

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\wuzh\npm-debug.log

求解???

阅读 3.9k
4 个回答

Unfortunately n is not supported on Windows yet. If you're able to make it work, send in a pull request!

n不支持win平台

windows不支持用n来更新nodejs,需要重新下载新版的msi在原目录覆盖安装

新手上路,请多包涵

我刚刚也遇到这个问题了,原因就是window不支持用“n”来更新。建议直接到官网下载.msi放到指定目录,然后点击安装即可。安装成功后cmd里面输入node -v来看版本号就行。
在这里我还要说一下,nodejs.cn里面下不到最新版本的nodeJS,要去nodejs.org里面可以下到最新的。刚刚我就是在一个项目里面疯狂报错,因为没用到最新的版本,async这个异步要7+版本才行。

新手上路,请多包涵

楼上正解,我也这样操作就可以了

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题