bcrypt installation fails on node-15 in Docker
See original GitHub issueHello,
The installation fails on the latest node version in docker (all Alpine and Debian dists).
FROM node:15-alpine
RUN apk --no-cache add --virtual builds-deps build-base python
[...]
RUN npm install
npm ERR! gyp WARN EACCES current user ("node") does not have permission to access the dev dir "/root/.cache/node-gyp/15.0.1"
npm ERR! gyp: Undefined variable module_name in binding.gyp while trying to load binding.gyp
npm ERR! gyp ERR! configure error
Verbose output (from npm or node-gyp):
npm notice
npm notice New patch version of npm available! 7.0.3 -> 7.0.5
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v7.0.5>
npm notice Run `npm install -g npm@7.0.5` to update!
npm notice
npm ERR! code 1
npm ERR! path /home/node/node_modules/bcrypt
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@15.0.1 | linux | x64
npm ERR! gyp info find Python using Python version 2.7.18 found at "/usr/bin/python"
npm ERR! gyp WARN EACCES current user ("node") does not have permission to access the dev dir "/root/.cache/node-gyp/15.0.1"
npm ERR! gyp WARN EACCES attempting to reinstall using temporary dev dir "/tmp/.node-gyp"
npm ERR! gyp http GET https://unofficial-builds.nodejs.org/download/release/v15.0.1/node-v15.0.1-headers.tar.gz
npm ERR! gyp http 200 https://unofficial-builds.nodejs.org/download/release/v15.0.1/node-v15.0.1-headers.tar.gz
npm ERR! gyp http GET https://unofficial-builds.nodejs.org/download/release/v15.0.1/SHASUMS256.txt
npm ERR! gyp http 200 https://unofficial-builds.nodejs.org/download/release/v15.0.1/SHASUMS256.txt
npm ERR! gyp info spawn /usr/bin/python
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/node/node_modules/bcrypt/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/tmp/.node-gyp/15.0.1/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/tmp/.node-gyp/15.0.1',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/tmp/.node-gyp/15.0.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/home/node/node_modules/bcrypt',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp: Undefined variable module_name in binding.gyp while trying to load binding.gyp
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:327:20)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:277:12)
npm ERR! gyp ERR! System Linux 4.19.76-linuxkit
npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /home/node/node_modules/bcrypt
npm ERR! gyp ERR! node -v v15.0.1
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Bcrypt installation fails in Docker - node.js - Stack Overflow
It is crashing because you are missing some essentials tool for the compilation purposes of Bcrypt. Bcrypt needs to be compiled each time ......
Read more >How to install bcrypt correctly on a node alpine image?-docker
Coding example for the question Dockerfile: How to install bcrypt ... bcrypt is not available pre-packaged on Alpine, so npm builds it from...
Read more >Install Bcrypt in Docker image and exclude host node_modules
Solution to first problem, setup Dockerfile to build Bcrypt. In your Dockerfile run this: RUN apk add --no-cache make gcc g++ python && ......
Read more >Install Bcrypt in Docker and resolve common errors - Bobcares
In order to solve this, we need to set up a docker-compose.yml file with a volumes field that can create a named volume...
Read more >The bcrypt bug on Docker - Medium
The advantage is that npm install would not have to reinstall all the ... locally but when I ran docker-compose up it gave...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
you’d better take this up with bcrypt I think, they’re doing some funky prebuild stuff with variables in their binding.gyp https://github.com/kelektiv/node.bcrypt.js/search?q=module_name&type=issues
I still run into the same issue: