不为别的,只为做一个连自己都羡慕的人

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

出现此类问题:
> libpq@1.8.9 install /var/www/username/repository/shared/node_modules/libpq > node-gyp rebuild Traceback (most recent call last): File "/usr/share/nodejs/node-gyp/gyp/gyp_main.py", line 6, in <module> from pkg_resources import load_entry_point File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3254, in <module> def _initialize_master_working_set(): File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3237, in _call_aside f(*args, **kwargs) File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3266, in _initialize_master_working_set working_set = WorkingSet._build_master() File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 584, in _build_master ws.require(__requires__) File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 901, in require needed = self.resolve(parse_requirements(requirements)) File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 787, 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/nodejs/node-gyp/lib/configure.js:355:16) gyp ERR! stack at ChildProcess.emit (events.js:198:13) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12) gyp ERR! System Linux 5.4.0-1029-aws gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild" gyp ERR! cwd /var/www/username/repository/shared/node_modules/libpq gyp ERR! node -v v10.19.0 gyp ERR! node-gyp -v v6.1.0 gyp ERR! not ok npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! libpq@1.8.9 install: `node-gyp rebuild` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the libpq@1.8.9 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /home/ubuntu/.npm/_logs/2020-12-03T23_02_09_847Z-debug.log
解决方法:
npm install --global npm@latest
npm install --global node-gyp@latest
npm config set node_gyp $(npm prefix -g)/lib/node_modules/node-gyp/bin/node-gyp.js
python3 --version
python3 -m pip --version

出处:

https://github.com/nodejs/node-gyp/issues/2273

posted @ 2021-06-07 15:02  升级打怪  阅读(1151)  评论(0编辑  收藏  举报