nodejs、npm 和 sailsjs 之间是否存在版本依赖问题?

is there any version dependency issues exist among nodejs, npm and sailsjs?

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

  1. sudo apt-get install nodejs
  2. nodejs -v returns v0.10.25
  3. sudo apt-get install npm
  4. npm -v returns 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

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

您还收到了 sails 中的警告,因为您有一个未满足的依赖版本。 如果你检查错误,它说明了它需要哪个版本的 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(我知道它适用于 sails)

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

同时检查下面的 link 如果上面的 none 有效(不确定你的问题是否可以被认为是重复的)


Cannot install packages using node package manager in Ubuntu