Node version: 14.17.5
Npm version: 7.42.0
The problem occurs on the virtual machine when starting CI/CD (rush update
or yarn
command).
I think it happens when I changed my node version, while not rebuilding npm package.
I cannot change the node version because then other problems will arise.
If you are using windows, to solve this issue, you could try to run: npm install --global --production windows-build-tools
and then: npm rebuild node-gyp
--> npm install sqlite3
. However, I'm using Ubuntu (20.04 lts) so I tried to build nodejs build tools sudo apt-get install -y build-essential
and then npm rebuild
and npm rebuild node-gyp
I also tried:
- npm uninstall node-pre-gyp
- npm uninstall sqlite3
- Download the package again:
- npm i node-pre-gyp -g
- npm i sqlite3 -s
- restart instance
and few more... (npm upgrade, clean chache, npm install -g node-gyp
)
Traceback:
les/sqlite3 install: gyp info it worked if it ends with ok
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info using node-gyp@7.1.2
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info using node@14.17.6 | linux | x64
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info ok
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info it worked if it ends with ok
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info using node-gyp@7.1.2
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info using node@14.17.6 | linux | x64
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info find Python using Python version 3.8.10 found at "/usr/bin/python3"
.../node_modules/tiny-secp256k1 install: make: Entering directory '/home/user/slave/workspace/app/common/temp/node_modules/.pnpm/[email protected]/node_modules/tiny-secp256k1/build'
.../node_modules/tiny-secp256k1 install: CXX(target) Release/obj.target/secp256k1/native/addon.o
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info spawn /usr/bin/python3
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info spawn args [
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info spawn args '/root/.rush/node-v14.17.6/pnpm-5.18.1/node_modules/pnpm/dist/node_modules/node-gyp/gyp/gyp_main.py',
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info spawn args 'binding.gyp',
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info spawn args '-f',
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info spawn args 'make',
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info spawn args '-I',
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info spawn args '/home/user/slave/workspace/app/common/temp/node_modules/.pnpm/[email protected]/node_modules/sqlite3/build/config.gypi',
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info spawn args '-I',
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info spawn args '/root/.rush/node-v14.17.6/pnpm-5.18.1/node_modules/pnpm/dist/node_modules/node-gyp/addon.gypi',
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info spawn args '-I',
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info spawn args '/root/.cache/node-gyp/14.17.6/include/node/common.gypi',
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info spawn args '-Dlibrary=shared_library',
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info spawn args '-Dvisibility=default',
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/14.17.6',
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info spawn args '-Dnode_gyp_dir=/root/.rush/node-v14.17.6/pnpm-5.18.1/node_modules/pnpm/dist/node_modules/node-gyp',
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/14.17.6/<(target_arch)/node.lib',
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info spawn args '-Dmodule_root_dir=/home/user/slave/workspace/app/common/temp/node_modules/.pnpm/[email protected]/node_modules/sqlite3',
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info spawn args '-Dnode_engine=v8',
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info spawn args '--depth=.',
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info spawn args '--no-parallel',
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info spawn args '--generator-output',
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info spawn args 'build',
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info spawn args '-Goutput_dir=.'
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info spawn args ]
.../node_modules/websocket install: make: Entering directory '/home/user/slave/workspace/app/common/temp/node_modules/.pnpm/github.com/web3-js/WebSocket-Node@ef5ea2f41daf4a2113b80c9223df884b4d56c400/node_modules/websocket/build'
.../node_modules/websocket install: CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info ok
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info it worked if it ends with ok
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info using node-gyp@7.1.2
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info using node@14.17.6 | linux | x64
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info spawn make
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
.../sqlite3@4.2.0/node_modules/sqlite3 install: make: Entering directory '/home/user/slave/workspace/app/common/temp/node_modules/.pnpm/[email protected]/node_modules/sqlite3/build'
.../sqlite3@4.2.0/node_modules/sqlite3 install: ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3310100/sqlite3.c
.../sqlite3@4.2.0/node_modules/sqlite3 install: /bin/sh: 1: python: not found
.../sqlite3@4.2.0/node_modules/sqlite3 install: make: *** [deps/action_before_build.target.mk:13: Release/obj/gen/sqlite-autoconf-3310100/sqlite3.c] Error 127
.../sqlite3@4.2.0/node_modules/sqlite3 install: make: Leaving directory '/home/user/slave/workspace/app/common/temp/node_modules/.pnpm/[email protected]/node_modules/sqlite3/build'
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp ERR! build error
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp ERR! stack Error: `make` failed with exit code: 2
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp ERR! stack at ChildProcess.onExit (/root/.rush/node-v14.17.6/pnpm-5.18.1/node_modules/pnpm/dist/node_modules/node-gyp/lib/build.js:194:23)
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp ERR! stack at ChildProcess.emit (events.js:400:28)
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp ERR! System Linux 5.8.0-1041-azure
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp ERR! command "/usr/bin/node" "/root/.rush/node-v14.17.6/pnpm-5.18.1/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/user/slave/workspace/app/common/temp/node_modules/.pnpm/[email protected]/node_modules/sqlite3/lib/binding/node-v83-linux-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/home/user/slave/workspace/app/common/temp/node_modules/.pnpm/[email protected]/node_modules/sqlite3/lib/binding/node-v83-linux-x64" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v83"
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp ERR! cwd /home/user/slave/workspace/app/common/temp/node_modules/.pnpm/sqlite3@4.2.0/node_modules/sqlite3
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp ERR! node -v v14.17.6
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp ERR! node-gyp -v v7.1.2
.../sqlite3@4.2.0/node_modules/sqlite3 install: gyp ERR! not ok
.../sqlite3@4.2.0/node_modules/sqlite3 install: node-pre-gyp ERR! build error
.../sqlite3@4.2.0/node_modules/sqlite3 install: node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /root/.rush/node-v14.17.6/pnpm-5.18.1/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/user/slave/workspace/app/common/temp/node_modules/.pnpm/[email protected]/node_modules/sqlite3/lib/binding/node-v83-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/user/slave/workspace/app/common/temp/node_modules/.pnpm/[email protected]/node_modules/sqlite3/lib/binding/node-v83-linux-x64 --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
.../sqlite3@4.2.0/node_modules/sqlite3 install: node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/user/slave/workspace/app/common/temp/node_modules/.pnpm/node-pre-gyp@0.11.0/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
.../sqlite3@4.2.0/node_modules/sqlite3 install: node-pre-gyp ERR! stack at ChildProcess.emit (events.js:400:28)
.../sqlite3@4.2.0/node_modules/sqlite3 install: node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1055:16)
.../sqlite3@4.2.0/node_modules/sqlite3 install: node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
.../sqlite3@4.2.0/node_modules/sqlite3 install: node-pre-gyp ERR! System Linux 5.8.0-1041-azure
.../sqlite3@4.2.0/node_modules/sqlite3 install: node-pre-gyp ERR! command "/usr/bin/node" "/home/user/slave/workspace/app/common/temp/node_modules/.pnpm/[email protected]/node_modules/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build"
.../sqlite3@4.2.0/node_modules/sqlite3 install: node-pre-gyp ERR! cwd /home/user/slave/workspace/app/common/temp/node_modules/.pnpm/sqlite3@4.2.0/node_modules/sqlite3
.../sqlite3@4.2.0/node_modules/sqlite3 install: node-pre-gyp ERR! node -v v14.17.6
.../sqlite3@4.2.0/node_modules/sqlite3 install: node-pre-gyp ERR! node-pre-gyp -v v0.11.0
.../sqlite3@4.2.0/node_modules/sqlite3 install: node-pre-gyp ERR! not ok
.../sqlite3@4.2.0/node_modules/sqlite3 install: Failed to execute '/usr/bin/node /root/.rush/node-v14.17.6/pnpm-5.18.1/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/user/slave/workspace/app/common/temp/node_modules/.pnpm/[email protected]/node_modules/sqlite3/lib/binding/node-v83-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/user/slave/workspace/app/common/temp/node_modules/.pnpm/[email protected]/node_modules/sqlite3/lib/binding/node-v83-linux-x64 --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
.../sqlite3@4.2.0/node_modules/sqlite3 install: Failed
ERROR Command failed with exit code 1.
The command failed:
/home/user/slave/workspace/app/common/temp/pnpm-local/node_modules/.bin/pnpm install --store /home/user/slave/workspace/app/common/temp/pnpm-store --no-prefer-frozen-lockfile
ERROR: Error: The command failed with exit code 1
Giving up after 3 attempts
Deleting the "pnpm-store" folder
ERROR: The command failed with exit code 1
The problem is only in the virtual machine and I don't know where to find a solution to this problem.
CodePudding user response:
TLDR;
Install / Re-install Python
and make sure it is in your $Path
sudo apt-get install python3
which python
Explanation
1. Investigation
While looking into the logs, to find hints on which part failed. I noticed this line:
.../[email protected]/node_modules/sqlite3 install: /bin/sh: 1: python: not found
Is it expected to be needing python to install sqlite3 via npm package by building the sources ? YES
It is mentioned in the documentation of sqlite3 on npm, you can read the following:
By default the node-gyp install will use python as part of the installation. A different python executable can be specified on the command line.
npm install --build-from-source --python=/usr/bin/python2
2. Fix
So in order to fix it. It seems you need to have in your $Path
the python binary.
To check if you have it just run:
which python
In our case it should be expected to get python not found
. I suggest you look into how to install python
for you operating system.
For user of the apt
dependency manager (ie: Ubuntu,...), it is as simple as:
sudo apt-get install python3
#check if it is now present in your $Path
which python