使用npm安装log.io时出错

时间:2015-02-28 13:26:22

标签: node.js installation npm

我正在尝试按照https://github.com/NarrativeScience/Log.io的说明安装log.io。它建议使用npm install命令。

npm install -g log.io

我得到的错误如下。我尝试了Mac OS和Ubuntu,都没有运气。任何人都可以帮助我吗?

> contextify@0.1.13 install /usr/local/lib/node_modules/log.io/node_modules/jquery/node_modules/contextify
> node-gyp rebuild

npm http GET https://registry.npmjs.org/cssstyle
npm http GET https://registry.npmjs.org/cssom
npm http 304 https://registry.npmjs.org/cssom
npm http 304 https://registry.npmjs.org/cssstyle
gyp: Call to 'node -e "require('nan')"' returned exit status 1. 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:431:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.13.0-32-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/log.io/node_modules/jquery/node_modules/contextify
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok
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! Error: ENOENT, chown '/usr/local/lib/node_modules/log.io/node_modules/jquery/node_modules/jsdom/node_modules/request/README.md'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>
...

3 个答案:

答案 0 :(得分:4)

最后我发现了问题。

Ubuntu的

在Ubuntu 14.04上,节点的apt-get的默认存储库不是nodejs本身,而是ax25-node。这将在node中生成默认命令/usr/sbin/,如果您调用node(在安装期间由npm调用),则不执行任何操作。我删除了这个包并在node和nodejs之间创建了一个符号链接,最终解决了这个问题。

sudo apt-get autoremove node
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo npm install -g log.io

Mac OS

错误日志与我从Ubuntu获得的错误日志完全不同。在关于node-gyp安装失败的一些谷歌搜索之后,我找到了this issue,这导致我安装了Xcode开发工具。不知道为什么会发生这种情况,但似乎自制软件和Xcode之间存在一些冲突。无论如何,它终于有效: - )

答案 1 :(得分:1)

这看起来像旧版npm中的竞争条件。自从1.4以来,npm已经有了很多改进 - 特别是在安装期间的冲突和竞争条件方面。你能尝试更新你的npm安装吗?

要在Windows上更新npm,请按照此处的说明操作:https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows

如果您在更新npm后仍然看到问题,请将您的npm-debug.log上传为gist http://gist.github.com吗?如果可能,运行带有至少一个-d标志的npm以提高日志记录级别。

谢谢!

答案 2 :(得分:-1)

我创建了这个安装包......

http://tinyurl.com/kfnfng6

1 - 下载

2 - 解压缩它(tar -xvf install_log.io.tar)

3 - cd install_log.io

4 - sh install.sh

5 - 享受!

这种形式简单而安静..我希望帮助其他用户......我做什么?简单..下载包和依赖项,并将所有内容放在一个包中并创建一个脚本...

相关问题