如何修复gyp错误!在npm内部)

问题描述 投票:0回答:1

我最近构建了一个平均堆栈应用并将其容器化。但是,我无法在树莓派上构建它,并且我不理解该错误。

当我在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 [email protected] and [email protected]                                                                                                                                                              (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 [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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一个。

您能向我解释为什么会发生此错误吗?我应该完全满足什么依赖性以及如何在容器内获取日志?

docker npm node-gyp node-pre-gyp
1个回答
0
投票

如果您确实不需要Node 13,也许您可​​以尝试使用Node 8(使用NVM或选择正确的Node Docker映像)。

这将跳过建立bcrypt

(之所以构建bcrypt的原因是因为NPM“未为[email protected][email protected]找到预构建的二进制文件]

© www.soinside.com 2019 - 2024. All rights reserved.