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

and*_*ndy 0 debian node.js npm 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

之后我得到以下错误:

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
Run Code Online (Sandbox Code Playgroud)

Zag*_*gen 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
Run Code Online (Sandbox Code Playgroud)

要查看是否更新了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
Run Code Online (Sandbox Code Playgroud)

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

我有ubuntu所以我无法检查,但这应该工作.

如果上述方法均无效,请检查以下链接(不确定您的问题是否可以视为重复)


无法在Ubuntu中使用节点包管理器安装包