Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The gyp==0.1 distribution was not found

My project doesn't compile due to a problem with the bson node.js module. I tried to make it manually and got an error - 'gyp==0.1' not found by a Python script:

pkg_resources.DistributionNotFound: The 'gyp==0.1' distribution was not found and is required by the application

Console:

~/keystone-react/node_modules/bson$ make
node-gyp clean
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info ok 
node-gyp configure build
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | 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

Original error:

~/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
------------------------------------------------
like image 822
Peter G. Avatar asked Oct 13 '16 15:10

Peter G.


People also ask

Does node-gyp require Python?

node-gyp requires that you have installed a compatible version of Python, one of: v3. 7, v3. 8, v3. 9, or v3.


Video Answer


2 Answers

You can install gyp module by pip with following command:

pip install git+https://chromium.googlesource.com/external/gyp
like image 175
a13xg0 Avatar answered Nov 15 '22 00:11

a13xg0


Pip supports installation from VCS repositories as described here.

The following worked for me:

pip install https://github.com/nodejs/node-gyp#subdirectory=gyp

like image 30
bergercookie Avatar answered Nov 15 '22 00:11

bergercookie