由于bson
node.js模块存在问题,我的项目无法编译。我手动尝试make
并发现错误 - ' gyp == 0.1' Python脚本找不到:
pkg_resources.DistributionNotFound:' gyp == 0.1'分配是 找不到并且是应用程序要求的
控制台:
~/keystone-react/node_modules/bson$ make
node-gyp clean
gyp info it worked if it ends with ok
gyp info using node-gyp@0.12.2
gyp info using node@0.10.29 | linux | x64
gyp info ok
node-gyp configure build
gyp info it worked if it ends with ok
gyp info using node-gyp@0.12.2
gyp info using node@0.10.29 | linux | x64
gyp info spawn python
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/user/keystone-react/node_modules/bson/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 '-Dmodule_root_dir=/home/user/keystone-react/node_modules/bson',
gyp info spawn args '--depth=.',
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 9, in <module>
load_entry_point('gyp==0.1', 'console_scripts', 'gyp')()
File "/opt/bitnami/python/lib/python2.7/site-packages/pkg_resources/__init__.py", line 567, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/opt/bitnami/python/lib/python2.7/site-packages/pkg_resources/__init__.py", line 559, in get_distribution
dist = get_provider(dist)
File "/opt/bitnami/python/lib/python2.7/site-packages/pkg_resources/__init__.py", line 433, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
File "/opt/bitnami/python/lib/python2.7/site-packages/pkg_resources/__init__.py", line 970, in require
needed = self.resolve(parse_requirements(requirements))
File "/opt/bitnami/python/lib/python2.7/site-packages/pkg_resources/__init__.py", line 856, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'gyp==0.1' distribution was not found and is required by the application
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:344:16)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:809:12)
gyp ERR! System Linux 3.16.0-4-amd64
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "configure" "build"
gyp ERR! cwd /home/user/keystone-react/node_modules/bson
gyp ERR! node -v v0.10.29
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
Makefile:11: recipe for target 'node_gyp' failed
make: *** [node_gyp] Error 1
原始错误:
~/keystone-react$ node keystone
{ Error: Cannot find module '../build/Release/bson'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/user/keystone-react/node_modules/bson/ext/index.js:15:10)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/user/keystone-react/node_modules/bson/lib/bson/index.js:3:24)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32) code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
------------------------------------------------
KeystoneJS Started:
keystone-react is ready on port 3000
------------------------------------------------
答案 0 :(得分:3)
您可以使用以下命令通过pip安装gyp模块:
pip install git+https://chromium.googlesource.com/external/gyp
答案 1 :(得分:1)