HI everyone,
I’m having an issue when i´m trying to build an image for my web app. I tried everything, don’t know if is a Docker issue or not but I really can’t find a solution. The error is: (I have python in my path, i can npm install gyp out of the build, I can do a npm install out of the docker build)
[5/7] RUN npm install:
35.28
35.28 > bcrypt@5.0.0 install /home/node/app/node_modules/bcrypt
35.28 > node-pre-gyp install --fallback-to-build
35.28
35.43 node-pre-gyp WARN Using needle for node-pre-gyp https download
35.68 node-pre-gyp WARN Pre-built binaries not installable for bcrypt@5.0.0 and node@14.15.1 (node-v83 ABI, musl) (falling back to source compile with node-gyp)
35.68 node-pre-gyp WARN Hit error unable to get local issuer certificate
35.88 gyp ERR! find Python
35.88 gyp ERR! find Python Python is not set from command line or npm configuration
35.88 gyp ERR! find Python Python is not set from environment variable PYTHON
35.88 gyp ERR! find Python checking if “python” can be used
35.88 gyp ERR! find Python - “python” is not in PATH or produced an error
35.88 gyp ERR! find Python checking if “python2” can be used
35.88 gyp ERR! find Python - “python2” is not in PATH or produced an error
35.88 gyp ERR! find Python checking if “python3” can be used
35.88 gyp ERR! find Python - “python3” is not in PATH or produced an error
35.88 gyp ERR! find Python
35.88 gyp ERR! find Python **********************************************************
35.88 gyp ERR! find Python You need to install the latest version of Python.
35.88 gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
35.88 gyp ERR! find Python you can try one of the following options:
35.88 gyp ERR! find Python - Use the switch --python=“/path/to/pythonexecutable”
35.88 gyp ERR! find Python (accepted by both node-gyp and npm)
35.88 gyp ERR! find Python - Set the environment variable PYTHON
35.88 gyp ERR! find Python - Set the npm configuration variable python:
35.88 gyp ERR! find Python npm config set python “/path/to/pythonexecutable”
35.88 gyp ERR! find Python For more information consult the documentation at:
35.88 gyp ERR! find Python GitHub - nodejs/node-gyp: Node.js native addon build tool
35.88 gyp ERR! find Python **********************************************************
35.88 gyp ERR! find Python
35.88 gyp ERR! configure error
35.88 gyp ERR! stack Error: Could not find any Python installation to use
35.88 gyp ERR! stack at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:307:47)
35.88 gyp ERR! stack at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:136:21)
35.88 gyp ERR! stack at PythonFinder. (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:179:16)
35.88 gyp ERR! stack at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:271:16)
35.88 gyp ERR! stack at exithandler (child_process.js:315:5)
35.88 gyp ERR! stack at ChildProcess.errorhandler (child_process.js:327:5)
35.88 gyp ERR! stack at ChildProcess.emit (events.js:315:20)
35.88 gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
35.88 gyp ERR! stack at onErrorNT (internal/child_process.js:465:16)
35.88 gyp ERR! stack at processTicksAndRejections (internal/process/task_queues.js:80:21)
35.88 gyp ERR! System Linux 5.15.153.1-microsoft-standard-WSL2
35.88 gyp ERR! command “/usr/local/bin/node” “/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” “configure” “–fallback-to-build” “–module=/home/node/app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node” “–module_name=bcrypt_lib” “–module_path=/home/node/app/node_modules/bcrypt/lib/binding/napi-v3” “–napi_version=7” “–node_abi_napi=napi” “–napi_build_version=3” “–node_napi_label=napi-v3”
35.88 gyp ERR! cwd /home/node/app/node_modules/bcrypt
35.88 gyp ERR! node -v v14.15.1
35.88 gyp ERR! node-gyp -v v5.1.0
35.88 gyp ERR! not ok
35.89 node-pre-gyp ERR! build error
35.89 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=/home/node/app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/home/node/app/node_modules/bcrypt/lib/binding/napi-v3 --napi_version=7 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3’ (1)
35.89 node-pre-gyp ERR! stack at ChildProcess. (/home/node/app/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
35.89 node-pre-gyp ERR! stack at ChildProcess.emit (events.js:315:20)
35.89 node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1048:16)
35.89 node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
35.89 node-pre-gyp ERR! System Linux 5.15.153.1-microsoft-standard-WSL2
35.89 node-pre-gyp ERR! command “/usr/local/bin/node” “/home/node/app/node_modules/.bin/node-pre-gyp” “install” “–fallback-to-build”
35.89 node-pre-gyp ERR! cwd /home/node/app/node_modules/bcrypt
35.89 node-pre-gyp ERR! node -v v14.15.1
35.89 node-pre-gyp ERR! node-pre-gyp -v v0.15.0
35.89 node-pre-gyp ERR! not ok
35.89 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=/home/node/app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/home/node/app/node_modules/bcrypt/lib/binding/napi-v3 --napi_version=7 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3’ (1)
36.25 npm WARN backend@0.11.0 No license field.
36.26 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/fsevents):
36.26 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
36.26
36.28 npm ERR! code ELIFECYCLE
36.28 npm ERR! errno 1
36.28 npm ERR! bcrypt@5.0.0 install:node-pre-gyp install --fallback-to-build
36.28 npm ERR! Exit status 1
36.28 npm ERR!
36.28 npm ERR! Failed at the bcrypt@5.0.0 install script.
36.28 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
36.32
36.32 npm ERR! A complete log of this run can be found in:
36.32 npm ERR! /home/node/.npm/_logs/2025-03-14T01_43_53_834Z-debug.log
Dockerfile:17
15 | COPY --chown=node package*.json ./
16 |
17 | >>> RUN npm install
18 |
19 | # Bundle app source code
ERROR: failed to solve: process “/bin/sh -c npm install” did not complete successfully: exit code: 1