无法安装ssh2节点模块

时间:2013-07-13 02:51:17

标签: node.js nvm

我尝试通过发出命令sudo npm install ssh2从https://github.com/mscdex/ssh2安装ssh2。但它显示错误如下:

ERR! Error: No compatible version found: ssh2
ERR! No valid targets found.
ERR! Perhaps not compatible with your version of node?
ERR!     at installTargetsError (/usr/share/npm/lib/cache.js:488:10)
ERR!     at next_ (/usr/share/npm/lib/cache.js:438:17)
ERR!     at next (/usr/share/npm/lib/cache.js:415:44)
ERR!     at /usr/share/npm/lib/cache.js:408:5
ERR!     at saved (/usr/share/npm/lib/utils/npm-registry-client/get.js:147:7)
ERR!     at Object.oncomplete (/usr/lib/nodejs/graceful-fs.js:230:7)
ERR! You may report this log at:
ERR!     <http://bugs.debian.org/npm>
ERR! or use
ERR!     reportbug --attach /home/iwan/dev/workspace-nodejs/db-backup/npm-debug.log npm
ERR! 
ERR! System Linux 3.8.0-26-generic
ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "ssh2"
ERR! cwd /home/iwan/dev/workspace-nodejs/db-backup
ERR! node -v v0.6.19
ERR! npm -v 1.1.4
ERR! message No compatible version found: ssh2
ERR! message No valid targets found.
ERR! message Perhaps not compatible with your version of node?
verbose exit [ 1, true ]

我正在使用nvm和节点v0.10.13,但在错误中它显示我当前正在使用节点v0.6.19。

node -v
v0.10.13

会发生什么?

2 个答案:

答案 0 :(得分:1)

尝试不使用sudo:npm install ssh2

答案 1 :(得分:0)

是的,错误是ssh2需要节点>=0.8.7,并且您的PATH和/或nvm设置会导致您执行在节点v0.6下运行的旧版本的npm。这绝对是个问题。通过使用完整的文件系统路径安装并正确执行特定版本的npm而不仅仅是npm来修复它,它将起作用。