我的 Ubuntu 在上一个版本(更新、升级、dist-upgrade)上已完全更新,但是当我尝试这样做时:
mathrobin@mathrobin-pc:~$ sudo npm install -g yo
我明白了:
npm ERR! Error: No compatible version found: nopt@'>=2.1.1- <2.2.0-'
npm ERR! Valid install targets:
npm ERR! ["1.0.0","1.0.1","1.0.2","1.0.3","1.0.4","1.0.5","1.0.6","1.0.7","1.0.8","1.0.9","1.0.10"]
npm ERR! at installTargetsError (/usr/lib/node_modules/npm/lib/cache.js:506:10)
npm ERR! at next_ (/usr/lib/node_modules/npm/lib/cache.js:452:17)
npm ERR! at next (/usr/lib/node_modules/npm/lib/cache.js:427:44)
npm ERR! at /usr/lib/node_modules/npm/lib/cache.js:419:5
npm ERR! at saved (/usr/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:136:7)
npm ERR! at /usr/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:230:7
npm ERR! at Object.oncomplete (fs.js:297:15)
npm ERR! [Error: No compatible version found: nopt@'>=2.1.1- <2.2.0-'
npm ERR! Valid install targets:
npm ERR! ["1.0.0","1.0.1","1.0.2","1.0.3","1.0.4","1.0.5","1.0.6","1.0.7","1.0.8","1.0.9","1.0.10"]]
npm ERR! You may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>
npm ERR! System Linux 3.2.0-54-generic
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "yo"
npm ERR! cwd /home/mathrobin
npm ERR! node -v v0.8.9
npm ERR! npm -v 1.1.26
npm ERR! message No compatible version found: nopt@'>=2.1.1- <2.2.0-'
npm ERR! message Valid install targets:
npm ERR! message ["1.0.0","1.0.1","1.0.2","1.0.3","1.0.4","1.0.5","1.0.6","1.0.7","1.0.8","1.0.9","1.0.10"]
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/mathrobin/npm-debug.log
npm ERR! not ok code 0
我能做些什么来解决这个问题?
最佳答案
根据yo package.json file , 只有当您的 node.js
版本是 0.8.x
或更高版本以及您的 npm
版本是 1.2.10
或更高。
您的 node.js 0.8.9
很好,但是你的 npm 1.1.26
太旧了。
您可以升级您的npm
使用 official script from npm 的版本(仅限 Unix!)。或者你可以看看npm Readme.md寻找替代选择。
当前npm
版本是 1.3.11
.
我还建议您安装最新的稳定版 node.js
版本,即 0.10.21
.最简单的方法是使用一些版本管理器,如 n (可以安装 npm
和 npm install -g n
)。
关于node.js - 由于 npm 中的问题,无法在 ubuntu 上安装带有 nopt 的 Node 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19519639/