Как исправить gyp ERR! внутри сборки npm - PullRequest
0 голосов
/ 26 мая 2020

Недавно я создал приложение среднего стека и поместил его в контейнер. Однако у меня возникли проблемы с его сборкой на моем Raspberry Pi, и я не понимаю ошибки.

Когда я создаю свое приложение на моей машине 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.

Вы можете мне объяснить, почему возникают эти ошибки? Какую зависимость мне следует заполнить и как получить журнал внутри контейнера?

1 Ответ

0 голосов
/ 03 июня 2020

Если вам действительно не нужен Node 13, возможно, вы можете попробовать использовать Node 8 (либо используя NVM, либо выбрав правильный образ Node Docker).

Это пропустит сборку bcrypt.

(Причина, по которой вы даже создаете bcrypt, состоит в том, что NPM «Предварительно созданные двоичные файлы не найдены для bcrypt@4.0.1 и node@13.1.0»)

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...