node.js添加c++插件的几个问题

问题一:在node-gyp时,报错Error:can't find python exexutable "python" .
查看报错原因为找不到Python,故安装Python。安装了Python3.6后任报错,查文档得知必须安装Python2.7。
故:1.node-gyp --python /path/to/python2.7
2.npm config set python /path/to/executable/python2.7
3.安装Python2.7

问题二:Ubuntu环境下,Arguments does not name a type.
原因:v8高版本不兼容,需要用nan进行包装。
Nan:存储开发本机node.js插件所需的所有逻辑而不必检查NODE_MODULE_VERSION。
步骤:1.添加Nan作为node.js中的依赖关系。
npm install --save nan
2.在binding.gyp中拉入nan路径,以便在.cpp文件中使用#include

原文地址:https://www.cnblogs.com/lytyq/p/6638451.html