gpt4 book ai didi

node.js - 使用 npm 安装 log.io 时出错

转载 作者:搜寻专家 更新时间:2023-11-01 00:31:59 25 4
gpt4 key购买 nike

我正在尝试按照 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>
...

最佳答案

终于找到问题了。

Ubuntu

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

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

苹果操作系统

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

关于node.js - 使用 npm 安装 log.io 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28782219/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com