由于 Python,无法构建节点包
Fails to build node package due to Python
这似乎已解决 post 只是为了帮助遇到同样问题的人。
我试图安装 noble(ancs 的依赖项)但遇到了问题
$ npm install -g noble
npm WARN optional dep failed, continuing xpc-connection@0.1.3
> noble@0.3.13 install /usr/local/lib/node_modules/noble
> node-gyp rebuild
gyp ERR! configure error
gyp ERR! stack Error: spawn /path/to/executable/python2.7 ENOENT
gyp ERR! stack at exports._errnoException (util.js:746:11)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
gyp ERR! stack at child_process.js:1144:20
gyp ERR! stack at process._tickCallback (node.js:355:11)
gyp ERR! System Linux 3.19.3-3-ARCH
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/noble
gyp ERR! node -v v0.12.2
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
npm ERR! Linux 3.19.3-3-ARCH
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "noble"
npm ERR! node v0.12.2
npm ERR! npm v2.7.5
npm ERR! code ELIFECYCLE
npm ERR! noble@0.3.13 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the noble@0.3.13 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the noble 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 their info via:
npm ERR! npm owner ls noble
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/yi/npm-debug.log
然后尝试将 npm 配置 python 版本更改为 3.4.3,
$ npm config set python /usr/bin/python
还是失败了。
但是当改为python2时,就可以了。
$ npm config set python /usr/bin/python2
当前配置的 npm python 版本是
$ /usr/bin/python2 -V
Python 2.7.9
正如 abarnet 提到的,这个问题是由 archlinux 发行版引起的,我自己的解决方案是将 npm 配置 python 版本更改为 /usr/bin/python2。
$ npm config set python /usr/bin/python2
这似乎已解决 post 只是为了帮助遇到同样问题的人。
我试图安装 noble(ancs 的依赖项)但遇到了问题
$ npm install -g noble
npm WARN optional dep failed, continuing xpc-connection@0.1.3
> noble@0.3.13 install /usr/local/lib/node_modules/noble
> node-gyp rebuild
gyp ERR! configure error
gyp ERR! stack Error: spawn /path/to/executable/python2.7 ENOENT
gyp ERR! stack at exports._errnoException (util.js:746:11)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
gyp ERR! stack at child_process.js:1144:20
gyp ERR! stack at process._tickCallback (node.js:355:11)
gyp ERR! System Linux 3.19.3-3-ARCH
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/noble
gyp ERR! node -v v0.12.2
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
npm ERR! Linux 3.19.3-3-ARCH
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "noble"
npm ERR! node v0.12.2
npm ERR! npm v2.7.5
npm ERR! code ELIFECYCLE
npm ERR! noble@0.3.13 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the noble@0.3.13 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the noble 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 their info via:
npm ERR! npm owner ls noble
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/yi/npm-debug.log
然后尝试将 npm 配置 python 版本更改为 3.4.3,
$ npm config set python /usr/bin/python
还是失败了。
但是当改为python2时,就可以了。
$ npm config set python /usr/bin/python2
当前配置的 npm python 版本是
$ /usr/bin/python2 -V
Python 2.7.9
正如 abarnet 提到的,这个问题是由 archlinux 发行版引起的,我自己的解决方案是将 npm 配置 python 版本更改为 /usr/bin/python2。
$ npm config set python /usr/bin/python2