node.js - Nodejs、npm 和 sailsjs 之间是否存在版本依赖问题?

标签 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

之后我收到以下错误:

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 中的存储库重新安装 Node

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 更改为所需的 Node 版本,但我建议您安装最新的 4.1.0(我知道它适用于 sails)

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

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

<小时/>

Cannot install packages using node package manager in Ubuntu

关于node.js - Nodejs、npm 和 sailsjs 之间是否存在版本依赖问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33973991/

相关文章:

linux - 怎么解决??收集2 : error: ld returned 1 exit status in Debian GCC terminal

python-2.7 - 带有 "--enable-shared"标志的奇怪 Python 编译结果

mysql - Linux、Ubuntu - 负载非常高但不使用 cpu/ram

node.js - Armbian_5.24+橙pi零+nodejs+gpio访问

node.js - 如何从 package.json 中列出的 node_modules 中删除所有包

Angular-CLI 不接受 .angular-cli.json 中的 cdn

linux - 通过 Linux 主机进行身份验证

mysql - 连接 node.js 和 sphinx 的最佳方式

node.js - 引用错误: Node is not defined (trying to use Node interface in typescript function in nodejs application)

node.js - Node 和 NPM 运行脚本和 Ctrl-C 触发 SIGINT 两次