Node 是一个让 JavaScript 运行在服务端的开发平台, 它让 JavaScript 成为与 PHP,Python,Perl,Ruby 等服务端语言平起平坐的脚本语言.
更新 node 版本的方法:
1, 更新 node 版本命令:
NPM install -g n
2, 升级 node 到最新稳定版
n stable
遇到的错误:
- 1 ,
- D:\webpack>NPM install -g n
- NPM ERR! Windows_NT 6.1.7601
- NPM ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\Node.JS\
- node_modules\NPM\bin\NPM-cli.JS""install" "-g" "n"
- NPM ERR! node v6.9.2
- NPM ERR! NPM v3.10.9
- NPM ERR! code EBADPLATFORM
- NPM ERR! notsup Unsupported platform for n@2.1.8: wanted {
- "os":"!win32","arch":"any"
- } (current: {
- "os":"win32","arch":"x64"
- })
- 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! D:\webpack\NPM-debug.log
解决方案
NPM install -g n --force 或 - f: 强制重新安装
- 2,
- D:\webpack>NPM install webpack -save-dev
- NPM ERR! Windows_NT 6.1.7601
- NPM ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\Node.JS\
- node_modules\NPM\bin\NPM-cli.JS""install" "webpack" "-save-dev"
- NPM ERR! node v6.9.2
- NPM ERR! NPM v3.10.9
- NPM ERR! code ENOSELF
- NPM ERR! Refusing to install webpack as a dependency of itself
- NPM ERR!
- NPM ERR! If you need help, you may report this error at:
- NPM ERR! https://github.com/npm/npm/issues
- NPM ERR! Please include the following file with any support request:
- NPM ERR! D:\webpack\NPM-debug.log
解决方案:
出现问题是因为: package.JSON 中已经有 webpack 了, 换个名字就行了
来源: http://www.css88.com/qa/node-js/11951.html