如何在 npm 构建中修复 gyp ERR!



我最近构建了一个平均堆栈应用程序并将其容器化。但是,我无法在我的树莓派上构建它,我不明白这个错误。

当我在我的 debian 机器上构建我的应用程序时,一切都完美地构建。即使我在构建过程中得到这一行:

node-pre-gyp WARN Using needle for node-pre-gyp https download

不幸的是,我不能在我的覆盆子上建造相同的容器。此警告变得非常糟糕,并以错误代码 1 退出:

node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://github.com/kelektiv/node.bcryp                                                                                                                                                             t.js/releases/download/v4.0.1/bcrypt_lib-v4.0.1-napi-v3-linux-arm-musl.tar.gz
node-pre-gyp WARN Pre-built binaries not found for bcrypt@4.0.1 and node@13.1.0                                                                                                                                                              (node-v79 ABI, musl) (falling back to source compile with node-gyp)
gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - "python" is not in PATH or produced an error
gyp ERR! find Python checking if "python2" can be used
gyp ERR! find Python - "python2" is not in PATH or produced an error
gyp ERR! find Python checking if "python3" can be used
gyp ERR! find Python - "python3" is not in PATH or produced an error
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
gyp ERR! find Python   (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack     at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_mo                                                                                                                                                             dules/node-gyp/lib/find-python.js:307:47)
gyp ERR! stack     at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/no                                                                                                                                                             de_modules/node-gyp/lib/find-python.js:136:21)
gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/                                                                                                                                                             node_modules/node-gyp/lib/find-python.js:179:16)
gyp ERR! stack     at PythonFinder.execFileCallback (/usr/local/lib/node_modules                                                                                                                                                             /npm/node_modules/node-gyp/lib/find-python.js:271:16)
gyp ERR! stack     at exithandler (child_process.js:302:5)
gyp ERR! stack     at ChildProcess.errorhandler (child_process.js:314:5)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_proces                                                                                                                                                             s.js:270:12)
gyp ERR! stack     at onErrorNT (internal/child_process.js:456:16)
gyp ERR! stack     at processTicksAndRejections (internal/process/task_queues.js                                                                                                                                                             :80:21)
gyp ERR! System Linux 4.19.97-v7l+
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_mod                                                                                                                                                             ules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/app/                                                                                                                                                             node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node" "--module_name=bcrypt_l                                                                                                                                                             ib" "--module_path=/app/node_modules/bcrypt/lib/binding/napi-v3" "--napi_version                                                                                                                                                             =5" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
gyp ERR! cwd /app/node_modules/bcrypt
gyp ERR! node -v v13.1.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local                                                                                                                                                             /lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback                                                                                                                                                             -to-build --module=/app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node                                                                                                                                                              --module_name=bcrypt_lib --module_path=/app/node_modules/bcrypt/lib/binding/napi                                                                                                                                                             -v3 --napi_version=5 --node_abi_napi=napi --napi_build_version=3 --node_napi_lab                                                                                                                                                             el=napi-v3' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/app/node_modules/node-                                                                                                                                                             pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1028:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/chi                                                                                                                                                             ld_process.js:283:5)
node-pre-gyp ERR! System Linux 4.19.97-v7l+
node-pre-gyp ERR! command "/usr/local/bin/node" "/app/node_modules/.bin/node-pre                                                                                                                                                             -gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /app/node_modules/bcrypt
node-pre-gyp ERR! node -v v13.1.0
node-pre-gyp ERR! node-pre-gyp -v v0.14.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modu                                                                                                                                                             les/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/app/node_mo                                                                                                                                                             dules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node --module_name=bcrypt_lib --modu                                                                                                                                                             le_path=/app/node_modules/bcrypt/lib/binding/napi-v3 --napi_version=5 --node_abi                                                                                                                                                             _napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
npm WARN clockmachine-api@1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bcrypt@4.0.1 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt@4.0.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional log                                                                                                                                                             ging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-05-26T14_29_34_636Z-debug.log
ERROR: Service 'backend' failed to build: The command '/bin/sh -c npm install' returned a non-zero code: 1

我不明白这个错误代码,因为我有python,python2和python3。此外,如果我键入 npm install node-pre-gyp,它可以工作,但不在容器内。我尝试清理 npm 缓存并使用不同的 nodejs 版本。第一个,12.16.3 和 14.x 一个。

你能向我解释为什么会发生此错误吗?我应该填写什么依赖项以及如何在容器内获取日志?

如果你真的不需要 Node 13,也许你可以尝试使用 Node 8(使用 NVM 或选择正确的 Node Docker 镜像(。

这将跳过构建bcrypt

(您甚至构建bcrypt的原因是因为 NPM"找不到适用于 bcrypt@4.0.1 和 node@13.1.0 的预构建二进制文件"(

相关内容

  • 没有找到相关文章

最新更新