ubuntu下nodejs编译C++ addon错误解决

在linux下编译nodejs 的C++ addon ,在windows下都是OK的,结果到了ubuntu下反而报错了,错误大概如下:

gyp ERR! Completion callback never invoked

搞了很久,各种搜索都找不到方法,后边进github里面看了下readme,尝试把npm 和node-pyg的pyhon路径设置了一下就可以了。

Configuring Python Dependency配置依赖

If you have multiple Python versions installed, you can identify which Python version node-gyp uses by setting the --pythonvariable:

$ node-gyp --python /user/bin/python2.7

If node-gyp is called by way of npmand you have multiple versions of Python installed, then you can set npm‘s ‘python’ config key to the appropriate value:

$ npm config set python /user/bin/python2.7

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注