- Node Version:
Node: v10.19.0
and NPM: 6.14.5
- Platform:
Ubuntu 20.04
- Module:
vscode-sqlite3
Verbose output (from npm or node-gyp):
gyp info it worked if it ends with ok
gyp info using node-gyp@6.1.0
gyp info using node@10.19.0 | linux | x64
gyp info find Python using Python version 2.7.18 found at "/usr/bin/python2"
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/usr/share/nodejs/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/varun/Desktop/WorkSpace/vscode/node_modules/vscode-sqlite3/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/share/nodejs/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/nodejs/node-gyp',
gyp info spawn args '-Dnode_lib_file=/usr/include/nodejs/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/home/varun/Desktop/WorkSpace/vscode/node_modules/vscode-sqlite3',
gyp info spawn args '-Dnode_engine=v8',
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=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/home/varun/Desktop/WorkSpace/vscode/node_modules/vscode-sqlite3/build'
ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3280000/sqlite3.c
/bin/sh: 1: python: not found
make: *** [deps/action_before_build.target.mk:13: Release/obj/gen/sqlite-autoconf-3280000/sqlite3.c] Error 127
make: Leaving directory '/home/varun/Desktop/WorkSpace/vscode/node_modules/vscode-sqlite3/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/share/nodejs/node-gyp/lib/build.js:194:23)
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-33-generic
gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "configure" "build"
gyp ERR! cwd /home/varun/Desktop/WorkSpace/vscode/node_modules/vscode-sqlite3
gyp ERR! node -v v10.19.0
gyp ERR! node-gyp -v v6.1.0
gyp ERR! not ok
Would it be possible to change node-gyp so that it doesn’t fail when there are multiple python versions installed? Or at least that it gives a reasonable error message?
I run into problems with this module every 6 months or so and it always is super frustrating and difficult to find a solution (or the problem, in the first place). And I never even used this module directly but it’s a dependency for every other module out there.
This works for me 😃
Please try:
NODE_GYP_FORCE_PYTHON=python3 <your command goes here>
@steveoni You have a different problem than the others on this issue. Please read https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md
I’m sorry to re-open this, I’ve tried all the methods listed here, but none resolve my issue.
system: Macbook I’m using
node = v12.20.2
andnpm = 7.19.1
, I’m using nvm to manage two different node environments. I thought it was because of the higher version of node that’s causing it, so I downgraded tov12.20.2
.with all the approaches listed here, I’m still obtaining this:
Thank you @cclauss, that actually worked.
What I am getting at is that I always find it difficult to find the correct solution.
In the last few hours I had a variety of different error messages from node-gyp, by trying to install the pg-native module. The error messages were:
Googeling these errors took some hours and a lot of retries until I reached at this thread and discovered that I need to set NODE_GYP_FORCE_PYTHON. Inbetween there was something about upgrading node-gyp as well but couldn’t find how to do it when it isn’t even mentioned in the package-lock.json and not installed as global module. And as mentioned, I have errors like these from node-gyp every half year or so and on different projects.
If the Python version issue is the source of a significant portion of build fails for people then it would be a huge help if this module could test for that and display a nice error message (instead of failing with one of the ones above) or even just set NODE_GYP_FORCE_PYTHON itself so it doesn’t even fail.