【问题标题】:Unable to install net-keepalive module on Ubuntu 16.04无法在 Ubuntu 16.04 上安装 net-keepalive 模块
【发布时间】:2016-08-16 04:04:04
【问题描述】:

我可以在我的 MAC 操作系统上安装 net-keepalive 模块,但不知道为什么我不能在我的 Ubuntu 16.04 上安装。 我想使用这个模块的原因是 node.JS 网络模块关闭事件没有按我的预期工作,TCP 服务器拔出 Etghernet 电缆需要一段时间才能执行关闭事件。我想要的是我的节点服务器能够在 TCP 服务器以太网电缆拔出或断电时进行判断。如果 net-keepalive 模块无法在 Ubuntu 上安装,我将非常乐意听到任何其他建议。

报错信息如下:

chroma@chromaUnity:~$ sudo npm install net-keepalive
[sudo] password for chroma: 

> ref@1.3.2 install /home/chroma/node_modules/net-keepalive/node_modules  /ref
> node-gyp rebuild

/bin/sh: 1: node: not found
gyp: Call to 'node -e "require('nan')"' returned exit status 127 while in binding.    
gyp. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/share/node-gyp/lib         
/configure.js:354:16)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 4.4.0-31-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/chroma/node_modules/net-keepalive/node_modules/ref
gyp ERR! node -v v4.2.6
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
/home/chroma
├─┬ body-parser@1.15.2 
│ └─┬ debug@2.2.0 
│   └── ms@0.7.1 
└── express@4.14.0 

npm WARN enoent ENOENT: no such file or directory, open '/home/chroma/package.json'
npm WARN chroma No description
npm WARN chroma No repository field.
npm WARN chroma No README data
npm WARN chroma No license field.
npm ERR! Linux 4.4.0-31-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "net-keepalive"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE

npm ERR! ref@1.3.2 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the ref@1.3.2 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ref package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs ref
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls ref
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/chroma/npm-debug.log

【问题讨论】:

  • 你也sudo apt-get install nodejs-legacy了吗?您似乎缺少 node 符号链接。
  • 您好 mscdex,非常感谢。有效。这是我的第一台 Ubuntu 机器,没有意识到它需要符号链接,你可以重新发布你的评论作为答案吗?我标记为答案。谢谢~~~

标签: node.js node-modules npm-install


【解决方案1】:

在 Ubuntu/Debian 上,如果您通过软件包管理器从普通发行版存储库安装 node.js,您还需要安装 nodejs-legacy 软件包,该软件包将添加常用的 node 可执行符号链接(而不仅仅是拥有nodejs 可执行文件)。

【讨论】:

    猜你喜欢
    • 2016-10-27
    • 1970-01-01
    • 2023-04-10
    • 2018-06-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-16
    • 2017-11-13
    相关资源
    最近更新 更多