【发布时间】:2016-03-31 14:24:00
【问题描述】:
我正在开发原生 Node.js 插件并关注 nan docs
我将 nan 包含在 binding.gyp 中,例如:
"include_dirs" : [ "<!(node -e \"require('nan')\")" ]
另外 nan 在 npm 依赖中。
但是当我在另一个节点模块中安装包时,node-gyp 失败并出现错误
> nnb@1.0.2 install /Users/Shopgate/sandbox/stress/node_modules/nnb
> node-gyp rebuild
module.js:338
throw err;
^
Error: Cannot find module 'nan'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at [eval]:1:1
at Object.exports.runInThisContext (vm.js:74:17)
at Object.<anonymous> ([eval]-wrapper:6:22)
at Module._compile (module.js:460:26)
at evalScript (node.js:431:25)
at startup (node.js:90:7)
gyp: Call to 'node -e "require('nan')"' returned exit status 1. while trying to load binding.gyp
【问题讨论】:
-
我遇到了同样的错误。而
npm install nan全部失败并出现错误:npm ERR! Cannot read property 'target' of null
标签: node.js npm node-gyp node.js-addon node.js-nan