在nodejs,npm和sailsjs之间是否存在任何版本依赖性问题?

时间:2015-11-28 17:03:55

标签: node.js npm debian sails.js

我按照这些步骤构建了我的第一个sailsjs MVC应用程序:

  1. sudo apt-get install nodejs
  2. nodejs -v返回v0.10.25
  3. sudo apt-get install npm
  4. npm -v返回1.3.10
  5. sudo npm install -g sails
  6. 之后我遇到了以下错误:

    npm http GET https://registry.npmjs.org/sails
    npm http 304 https://registry.npmjs.org/sails
    npm WARN engine sails@0.11.3: wanted: {"node":">= 0.10.0","npm":">= 1.4.0"} (current: {"node":"v0.10.25","npm":"1.3.10"})
    
    > sails@0.11.3 preinstall /usr/local/lib/node_modules/sails
    > node ./lib/preinstall_npmcheck.js
    
    sh: 1: node: not found
    npm WARN This failure might be due to the use of legacy binary "node"
    npm WARN For further explanations, please read
    /usr/share/doc/nodejs/README.Debian
    
    npm ERR! weird error 127
    npm ERR! not ok code 0
    

1 个答案:

答案 0 :(得分:5)

尝试sudo apt-get install nodejs-legacy,似乎debian维护者将包重命名为。

此外,您在帆中收到警告,因为您有一个未满足的依赖版本。 如果你检查错误,它会说明它需要哪个版本的npm,它说 "npm":">= 1.4.0"但您的系统上有1.3.10版本。您需要1.4.0或更新版本。

尝试

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

查看是否更新了npm

如果这不起作用,请尝试使用nodeSource

中的存储库重新安装节点
sudo apt-get install curl
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs

4.x更改为所需的节点版本,但我建议您安装4.1.0的最新版本(我知道它适用于风帆)

我有ubuntu所以我无法检查,但这应该有用。

如果以上都不起作用,请检查以下链接(不确定您的问题是否可以视为重复)

Cannot install packages using node package manager in Ubuntu