使用node-gyp编写Node.js的C/C++模块,建好了.cc和.gyp文件后,第一步“node-gyp configure”就报错了。
控制台信息如下:
root@lmn:/home/lmn/work# node-gyp configure
gyp info it worked if it ends with ok
gyp info using node-gyp@3.4.0
gyp info using node@4.2.6 | linux | x64
gyp info spawn /usr/local/bin/python2
gyp info spawn args [ ‘/usr/share/node-gyp/gyp/gyp_main.py’,
gyp info spawn args ‘binding.gyp’,
gyp info spawn args ‘-f’,
gyp info spawn args ‘make’,
gyp info spawn args ‘-I’,
gyp info spawn args ‘/home/lmn/work/build/config.gypi’,
gyp info spawn args ‘-I’,
gyp info spawn args ‘/usr/share/node-gyp/addon.gypi’,
gyp info spawn args ‘-I’,
gyp info spawn args ‘/usr/include/nodejs/common.gypi’,
gyp info spawn args ‘-Dlibrary=shared_library’,
gyp info spawn args ‘-Dvisibility=default’,
gyp info spawn args ‘-Dnode_root_dir=/usr/include/nodejs’,
gyp info spawn args ‘-Dnode_gyp_dir=/usr/share/node-gyp’,
gyp info spawn args ‘-Dnode_lib_file=node.lib’,
gyp info spawn args ‘-Dmodule_root_dir=/home/lmn/work’,
gyp info spawn args ‘–depth=.’,
gyp info spawn args ‘–no-parallel’,
gyp info spawn args ‘–generator-output’,
gyp info spawn args ‘build’,
gyp info spawn args ‘-Goutput_dir=.’ ]
Traceback (most recent call last):
File “/usr/share/node-gyp/gyp/gyp_main.py”, line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources
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:304:16)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 4.8.0-22-generic
gyp ERR! command “/usr/bin/nodejs” “/usr/bin/node-gyp” "configure"
gyp ERR! cwd /home/lmn/work
gyp ERR! node -v v4.2.6
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok