【问题标题】:Can't install ssh2 node module无法安装 ssh2 节点模块
【发布时间】:2013-07-13 02:51:16
【问题描述】:

我尝试通过发出命令 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

发生了什么?

【问题讨论】:

  • 可能是nvm use 0.10.13?
  • 我已经运行了该命令。仍然不行,我的意思是它产生了同样的错误。

标签: node.js nvm


【解决方案1】:

尝试不使用 sudo:npm install ssh2

【讨论】:

    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 2019-01-08
      • 2022-01-08
      • 2021-11-16
      • 2021-06-07
      • 2020-10-02
      • 2013-07-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多