无法安装 SQlite - node-pre-gyp 错误(ubuntu 20.04 lts)
Unable to install SQlite - error with node-pre-gyp ( ubuntu 20.04 lts)
节点版本: 14.17.5
Npm 版本: 7.42.0
虚拟机启动CI/CD(rush update
或yarn
命令)时出现问题。
我认为当我更改我的节点版本时会发生这种情况,而不是重建 npm 包。
我无法更改节点版本,因为那样会出现其他问题。
如果您使用的是 windows,要解决这个问题,您可以尝试 运行: npm install --global --production windows-build-tools
然后: npm rebuild node-gyp
--> npm install sqlite3
.但是,我正在使用 Ubuntu (20.04 lts) 所以我尝试构建 nodejs 构建工具 sudo apt-get install -y build-essential
然后 npm rebuild
和 npm rebuild node-gyp
我也试过:
- npm 卸载 node-pre-gyp
- npm 卸载 sqlite3
- 重新下载包:
- npm i node-pre-gyp -g
- npm i sqlite3 -s
- 重启实例
还有一些...(npm 升级,清理 chache,npm install -g node-gyp
)
回溯:
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/tiny-secp256k1@1.1.6/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/sqlite3@4.2.0/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/sqlite3@4.2.0/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/sqlite3@4.2.0/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/sqlite3@4.2.0/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/sqlite3@4.2.0/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/sqlite3@4.2.0/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/sqlite3@4.2.0/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/sqlite3@4.2.0/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/node-pre-gyp@0.11.0/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/sqlite3@4.2.0/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/sqlite3@4.2.0/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
问题只存在于虚拟机中,我不知道在哪里可以找到解决这个问题的方法。
TLDR;
安装/重新安装 Python
并确保它在您的 $Path
中
sudo apt-get install python3
which python
说明
1。调查
在查看日志时,找到有关哪个部分失败的提示。我注意到这一行:
.../sqlite3@4.2.0/node_modules/sqlite3 install: /bin/sh: 1: python: not found
是否需要 python 通过构建源代码通过 npm 包安装 sqlite3?是
在sqlite3 on npm的文档中有提到,您可以阅读以下内容:
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。修复
所以为了修复它。看来您的 $Path
中需要 python 二进制文件。
检查你是否拥有它 运行:
which python
在我们的例子中,应该得到 python not found
。我建议您研究一下如何为您的操作系统安装 python
。
对于 apt
依赖管理器的用户(即:Ubuntu,...),它很简单:
sudo apt-get install python3
#check if it is now present in your $Path
which python
节点版本: 14.17.5
Npm 版本: 7.42.0
虚拟机启动CI/CD(rush update
或yarn
命令)时出现问题。
我认为当我更改我的节点版本时会发生这种情况,而不是重建 npm 包。
我无法更改节点版本,因为那样会出现其他问题。
如果您使用的是 windows,要解决这个问题,您可以尝试 运行: npm install --global --production windows-build-tools
然后: npm rebuild node-gyp
--> npm install sqlite3
.但是,我正在使用 Ubuntu (20.04 lts) 所以我尝试构建 nodejs 构建工具 sudo apt-get install -y build-essential
然后 npm rebuild
和 npm rebuild node-gyp
我也试过:
- npm 卸载 node-pre-gyp
- npm 卸载 sqlite3
- 重新下载包:
- npm i node-pre-gyp -g
- npm i sqlite3 -s
- 重启实例
还有一些...(npm 升级,清理 chache,npm install -g node-gyp
)
回溯:
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/tiny-secp256k1@1.1.6/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/sqlite3@4.2.0/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/sqlite3@4.2.0/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/sqlite3@4.2.0/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/sqlite3@4.2.0/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/sqlite3@4.2.0/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/sqlite3@4.2.0/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/sqlite3@4.2.0/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/sqlite3@4.2.0/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/node-pre-gyp@0.11.0/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/sqlite3@4.2.0/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/sqlite3@4.2.0/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
问题只存在于虚拟机中,我不知道在哪里可以找到解决这个问题的方法。
TLDR;
安装/重新安装 Python
并确保它在您的 $Path
sudo apt-get install python3
which python
说明
1。调查
在查看日志时,找到有关哪个部分失败的提示。我注意到这一行:
.../sqlite3@4.2.0/node_modules/sqlite3 install: /bin/sh: 1: python: not found
是否需要 python 通过构建源代码通过 npm 包安装 sqlite3?是
在sqlite3 on npm的文档中有提到,您可以阅读以下内容:
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。修复
所以为了修复它。看来您的 $Path
中需要 python 二进制文件。
检查你是否拥有它 运行:
which python
在我们的例子中,应该得到 python not found
。我建议您研究一下如何为您的操作系统安装 python
。
对于 apt
依赖管理器的用户(即:Ubuntu,...),它很简单:
sudo apt-get install python3
#check if it is now present in your $Path
which python