使用 npm 安装 log.io 时出错

Error when installing log.io using 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>
...

这看起来像是旧版本 npm 中的竞争条件。自 1.4 以来,npm 有了很多改进——尤其是在安装期间的冲突和竞争条件方面。您可以尝试更新您的 npm 安装吗?

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

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

谢谢!

终于找到问题了。

Ubuntu

在Ubuntu 14.04上,node的apt-get默认存储库不是nodejs本身,而是ax25-node。这将在 /usr/sbin/ 中生成一个默认命令 node,如果您调用 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 之间似乎存在一些冲突。无论如何,它终于起作用了:-)

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

http://tinyurl.com/kfnfng6

1 - 下载它

2 - untar 它 (tar -xvf install_log.io.tar)

3 - cd install_log.io

4 - sh install.sh

5 - 尽情享受吧!

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

;)