can anyone help me to figure out this error? so I'm doing node version upgrade and dockerization tasks. we used node js 8.15.1 before now we want to update it to node js 16.15.0 the project was working on node 8.15.1 but when I tried to run npm install with node js 16.15.0 it got me node canvas error as below
npm ERR! code 1
npm ERR! path /app/node_modules/canvas
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! make: Entering directory '/app/node_modules/canvas/build'
npm ERR! SOLINK_MODULE(target) Release/obj.target/canvas-postbuild.node
npm ERR! COPY Release/canvas-postbuild.node
npm ERR! CXX(target) Release/obj.target/canvas/src/Canvas.o
npm ERR! make: Leaving directory '/app/node_modules/canvas/build'
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#16.15.0 | linux | x64
npm ERR! gyp info find Python using Python version 2.7.16 found at "/usr/bin/python"
npm ERR! gyp http GET https://nodejs.org/download/release/v16.15.0/node-v16.15.0-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.15.0/node-v16.15.0-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v16.15.0/SHASUMS256.txt
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.15.0/SHASUMS256.txt
npm ERR! (node:19) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp info spawn /usr/bin/python
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/app/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 '/app/node_modules/canvas/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/app/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/root/.cache/node-gyp/16.15.0/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=/root/.cache/node-gyp/16.15.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/app/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/16.15.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/app/node_modules/canvas',
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 info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
... // C++ build log
npm ERR! ^~~~~~~~
npm ERR! /root/.cache/node-gyp/16.15.0/include/node/v8.h:3060:44: note: candidate expects 1 argument, 0 provided
npm ERR! make: *** [canvas.target.mk:149: Release/obj.target/canvas/src/Canvas.o] Error 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess.onExit (/app/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:527:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Linux 5.4.0-107-generic
npm ERR! gyp ERR! command "/usr/local/bin/node" "/app/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /app/node_modules/canvas
npm ERR! gyp ERR! node -v v16.15.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-05-13T07_10_55_542Z-debug-0.log
The command '/bin/sh -c npm install node-libcurl --build-from-source' returned a non-zero code: 1
Here is my Dockerfile
FROM node:16.15.0
WORKDIR /app
COPY package*.json ./
RUN apt-get update && apt-get install -qq build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev g++ software-properties-common
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt install python3.7 -y
RUN npm config set python /usr/bin/python
RUN npm install -g node-gyp
RUN npm i -g node-pre-gyp
RUN npm install node-libcurl --build-from-source
RUN npm i canvas#2.9.1
RUN npm install -d
COPY . .
EXPOSE 3000
CMD ["npm","start"]
so my issue is every time I try to build this container using docker build -t qr . it got me the above error. can anyone tell me why I keep getting this error and how can I resolve this. thank you.
Related
I have node.js installed and I have tried various commands and installations but I keep getting a weird error when trying to do
npm install robotjs
So this is the error
root#name-VirtualBox:/home/name/Desktop# npm install robotjs
npm ERR! code 1
npm ERR! path /home/name/node_modules/robotjs
npm ERR! command failed
npm ERR! command sh -c prebuild-install || node-gyp rebuild
npm ERR! make: Entering directory '/home/name/node_modules/robotjs/build'
npm ERR! CXX(target) Release/obj.target/robotjs/src/robotjs.o
npm ERR! make: Leaving directory '/home/name/node_modules/robotjs/build'
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#8.4.1
npm ERR! gyp info using node#12.22.9 | linux | x64
npm ERR! gyp info find Python using Python version 3.10.6 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/usr/share/nodejs/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/name/node_modules/robotjs/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/usr/share/nodejs/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/usr/include/nodejs/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=/usr/include/nodejs',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/share/nodejs/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/usr/include/nodejs/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/home/name/node_modules/robotjs',
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 info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! cc1plus: warning: command-line option ‘-Wbad-function-cast’ is valid for C/ObjC but not for C++
npm ERR! In file included from ../src/keypress.h:6,
npm ERR! from ../src/robotjs.cc:7:
npm ERR! ../src/keycode.h:112:10: fatal error: X11/Xutil.h: No such file or directory
npm ERR! 112 | #include <X11/Xutil.h>
npm ERR! | ^~~~~~~~~~~~~
npm ERR! compilation terminated.
npm ERR! make: *** [robotjs.target.mk:133: Release/obj.target/robotjs/src/robotjs.o] Error 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess.onExit (/usr/share/nodejs/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (events.js:314:20)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
npm ERR! gyp ERR! System Linux 5.15.0-58-generic
npm ERR! gyp ERR! command "/usr/bin/node" "/usr/share/nodejs/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /home/name/node_modules/robotjs
npm ERR! gyp ERR! node -v v12.22.9
npm ERR! gyp ERR! node-gyp -v v8.4.1
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2023-02-06T22_27_59_161Z-debug-0.log
Any hint would be greatly appreciated!
NPM tells you that a header is missing to be able to compile the library with your version of node.
Just install the missing libraries for the installation of robotjs to pass.
Under Ubuntu:
sudo apt install libx11-dev libxtst-dev
Then the installation of robotjs works (tested on Ubuntu 22.04).
you need to install an older version of node.js to be able to run robotjs. An older version of node.js you can try is v12.16.1, and you may be able to run robotjs
I have a NextJS application on my Windows machine and have been able to use the zeromq package without any issue. But when I attempt to install the same project on my CentOS 7.9 VM, I get some error related to node-gyp. I tried following some steps on other threads but nothing solves my problem. I have also removed zeromq from package.json, deleted package-lock.json, and cleared my npm cache so that I can try a fresh installation of zeromq:
npm install zeromq
Here is the error log:
npm ERR! code 1
npm ERR! path /home/fsmdevuser/fsm-poc/web-app/node_modules/zeromq
npm ERR! command failed
npm ERR! command sh -c -- (shx test -f ./script/build.js || run-s build.js) && cross-env npm_config_build_from_source=true node-gyp-build
npm ERR! make: Entering directory `/home/fsmdevuser/fsm-poc/web-app/node_modules/zeromq/build'
npm ERR! TOUCH 7722eaf02fcc073df28ffd1fa831e71544edfd42.intermediate
npm ERR! ACTION binding_gyp_libzmq_target_build_libzmq 7722eaf02fcc073df28ffd1fa831e71544edfd42.intermediate
npm ERR! Downloading libzmq source from https://github.com/zeromq/libzmq/archive/20de92ac0a2b2b9a1869782a429df68f93c3625e.tar.gz
npm ERR! Building libzmq Release
npm ERR! cmake -S "libzmq-20de92ac0a2b2b9a1869782a429df68f93c3625e" -B ./build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/home/fsmdevuser/fsm-poc/web-app/node_modules/zeromq/build/libzmq" -DCMAKE_INSTALL_LIBDIR=lib -DBUILD_STATIC=ON -DBUILD_TESTS=OFF -DBUILD_SHARED=OFF -DWITH_DOCS=OFF -DWITH_LIBSODIUM=ON -DWITH_LIBSODIUM_STATIC=ON
npm ERR! cmake --build ./build --config Release --target install
npm ERR! TOUCH Release/obj.target/libzmq.stamp
npm ERR! CXX(target) Release/obj.target/zeromq/src/context.o
npm ERR! rm 7722eaf02fcc073df28ffd1fa831e71544edfd42.intermediate
npm ERR! make: Leaving directory `/home/fsmdevuser/fsm-poc/web-app/node_modules/zeromq/build'
npm ERR! /lib64/libc.so.6: version `GLIBC_2.33' not found (required by /home/fsmdevuser/fsm-poc/web-app/node_modules/zeromq/prebuilds/linux-x64/node.napi.glibc.node)
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#9.1.0
npm ERR! gyp info using node#16.18.1 | linux | x64
npm ERR! gyp info find Python using Python version 3.6.8 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/usr/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/fsmdevuser/fsm-poc/web-app/node_modules/zeromq/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/fsmdevuser/.cache/node-gyp/16.18.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=/home/fsmdevuser/.cache/node-gyp/16.18.1',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/home/fsmdevuser/.cache/node-gyp/16.18.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/home/fsmdevuser/fsm-poc/web-app/node_modules/zeromq',
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 info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! /bin/sh: cmake: command not found
npm ERR! /bin/sh: cmake: command not found
npm ERR! g++: error: unrecognized command line option ‘-std=gnu++14’
npm ERR! g++: error: unrecognized command line option ‘-std=c++17’
npm ERR! make: *** [Release/obj.target/zeromq/src/context.o] Error 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:201:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm ERR! gyp ERR! System Linux 3.10.0-1160.76.1.el7.x86_64
npm ERR! gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /home/fsmdevuser/fsm-poc/web-app/node_modules/zeromq
npm ERR! gyp ERR! node -v v16.18.1
npm ERR! gyp ERR! node-gyp -v v9.1.0
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! /home/fsmdevuser/.npm/_logs/2023-01-30T08_31_00_652Z-debug-0.log
If it helps, my Node version is 16.18.1, npm is 8.19.2 and node-gyp --version returns 0.10.6
Edit:
I attempted to sudo yum install cmake to see if it fixes anything and now I'm getting a shorter error message
npm ERR! code 126
npm ERR! path /home/fsmdevuser/fsm-poc/web-app/node_modules/zeromq
npm ERR! command failed
npm ERR! command sh -c -- (shx test -f ./script/build.js || run-s build.js) && cross-env npm_config_build_from_source=true node-gyp-build
npm ERR! sh: /home/fsmdevuser/fsm-poc/web-app/node_modules/.bin/cross-env: Permission denied
npm ERR! A complete log of this run can be found in:
npm ERR! /home/fsmdevuser/.npm/_logs/2023-01-30T08_50_27_526Z-debug-0.log
I had the same issue yesterday with another package heapdump on Ubuntu 22. The solution is to install node-gyp globally:
sudo npm install -g node-gyp
I am trying to run npm install for my Gatsby project on macOS Ventura.
sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
I've looked through all of the previous tickets relating to this error and tried the fixes. For example, I've tried deleting the tar.br file (previous post had tar.bg), installing vips via HomeBrew, and installing sharp via npm and sharp (npm failed but yarn worked after some tinkering).
I have node version 18.9 and sharp version 0.31.1. This is what I have set in my package.json: "gatsby-plugin-sharp": "^2.3.5", "gatsby-transformer-sharp": "^2.3.7"
Any help is appreciated! Thank you so much!!
The error seems to be coming from the gatsby-transformer-sharp module:
npm ERR! code 1
npm ERR! path /Users/seanshe/Desktop/bdab_website/node_modules/gatsby-transformer-sharp/node_modules/sharp
npm ERR! command failed
npm ERR! command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
npm ERR! CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
npm ERR! LIBTOOL-STATIC Release/nothing.a
npm ERR! TOUCH Release/obj.target/libvips-cpp.stamp
npm ERR! CXX(target) Release/obj.target/sharp/src/common.o
npm ERR! info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.10.5/libvips-8.10.5-darwin-arm64v8.tar.br
npm ERR! ERR! sharp Prebuilt libvips 8.10.5 binaries are not yet available for darwin-arm64v8
npm ERR! info sharp Attempting to build from source via node-gyp but this may fail due to the above error
npm ERR! info sharp Please see https://sharp.pixelplumbing.com/install for required dependencies
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#9.3.0
npm ERR! gyp info using node#19.4.0 | darwin | arm64
npm ERR! gyp info find Python using Python version 3.10.9 found at "/opt/homebrew/opt/python#3.10/bin/python3.10"
npm ERR! gyp info spawn /opt/homebrew/opt/python#3.10/bin/python3.10
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/opt/homebrew/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 '/Users/seanshe/Desktop/bdab_website/node_modules/gatsby-transformer-sharp/node_modules/sharp/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/seanshe/Library/Caches/node-gyp/19.4.0/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=/Users/seanshe/Library/Caches/node-gyp/19.4.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/seanshe/Library/Caches/node-gyp/19.4.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/seanshe/Desktop/bdab_website/node_modules/gatsby-transformer-sharp/node_modules/sharp',
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 info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! warning: /Library/Developer/CommandLineTools/usr/bin/libtool: archive library: Release/nothing.a the table of contents is empty (no object file members in the library define global symbols)
npm ERR! ../src/common.cc:24:10: fatal error: 'vips/vips8' file not found
npm ERR! #include <vips/vips8>
npm ERR! ^~~~~~~~~~~~
npm ERR! 1 error generated.
npm ERR! make: *** [Release/obj.target/sharp/src/common.o] Error 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess.onExit (/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:203:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm ERR! gyp ERR! System Darwin 22.2.0
npm ERR! gyp ERR! command "/opt/homebrew/Cellar/node/19.4.0/bin/node" "/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /Users/seanshe/Desktop/bdab_website/node_modules/gatsby-transformer-sharp/node_modules/sharp
npm ERR! gyp ERR! node -v v19.4.0
npm ERR! gyp ERR! node-gyp -v v9.3.0
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/seanshe/.npm/_logs/2023-01-11T05_40_20_443Z-debug-0.log
The error message suggests that prebuilt libvips 8.10.5 binaries are not available for the architecture "darwin-arm64v8" and it's attempting to build from source via node-gyp.
To resolve the issue, you can follow the steps mentioned in the sharp installation guide: https://sharp.pixelplumbing.com/install and install the required dependencies. It may also be helpful to check if your version of Node.js is compatible with the latest version of the sharp package.
I haven't had this issue previously, I have all the prerequisites for nodegyp (g++ make python) and it worked on alpine 3.13.
but as soon as node:14-alpine updated to the latest alpine it started failing during builds.
tldr: build works on alpine 3.13 but not on 3.14 - nodegyp issue
Docker version: Docker version 20.10.11, build dea9396
containerd containerd.io 1.4.12 7b11cfaabd73bb80907dd23182b9347b4245eb5d
Dockerfile:
FROM node:14-alpine as builder
RUN mkdir /app && chown node:node /app && npm i npm#latest -g
WORKDIR /app
COPY package*.json .npmrc ./
RUN apk add --no-cache --virtual .gyp python3 make g++ \
&& npm ci --only=production && npm cache clean --force \
&& apk del .gyp \
&& rm -f .npmrc
ENV PATH /app/node_modules/.bin:$PATH
COPY --chown=node:node . .
FROM builder as dev
WORKDIR /app
RUN npm ci
ENV PATH /app/node_modules/.bin:$PATH
USER node
CMD ["nodemon", "index.js"]
the full error is:
npm ERR! path /app/node_modules/xxhash
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! make: Entering directory '/app/node_modules/xxhash/build'
npm ERR! make: Leaving directory '/app/node_modules/xxhash/build'
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#8.4.1
npm ERR! gyp info using node#14.18.2 | linux | x64
npm ERR! gyp info find Python using Python version 3.9.5 found at "/usr/bin/python3"
npm ERR! gyp WARN EACCES current user ("node") does not have permission to access the dev dir "/root/.cache/node-gyp/14.18.2"
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/v14.18.2/node-v14.18.2-headers.tar.gz
npm ERR! gyp http 200 https://unofficial-builds.nodejs.org/download/release/v14.18.2/node-v14.18.2-headers.tar.gz
npm ERR! gyp http GET https://unofficial-builds.nodejs.org/download/release/v14.18.2/SHASUMS256.txt
npm ERR! gyp http 200 https://unofficial-builds.nodejs.org/download/release/v14.18.2/SHASUMS256.txt
npm ERR! gyp info spawn /usr/bin/python3
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 '/app/node_modules/xxhash/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/14.18.2/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/14.18.2',
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/14.18.2/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/app/node_modules/xxhash',
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 info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! make: printf: Operation not permitted
npm ERR! make: *** [hash.target.mk:117: Release/obj.target/hash/src/hash.o] Error 127
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (events.js:400:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:282:12)
npm ERR! gyp ERR! System Linux 5.4.0-1057-aws
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 /app/node_modules/xxhash
npm ERR! gyp ERR! node -v v14.18.2
npm ERR! gyp ERR! node-gyp -v v8.4.1
npm ERR! gyp ERR! not ok
Stuck after searching for a while and failing to find a solution
Had the same problem with docker image node:16.3.1-alpine (which uses alpine 3.14).
There seems to be an issue regarding your question with alpine 3.14 https://github.com/alpinelinux/docker-alpine/issues/178.
Alpine 3.15 should have this already fixed, but node docker image hasn't upgraded to alpine 3.15 yet.
Solved by downgrading alpine version to 3.13 (node:16.3.1-alpine3.13).
I executed npm install on gatsby js directory on Mac.
macOs is Big Sur
Version is 11.4.
gatsby version is 3.11.0
gatsby-plugin-sharp version is 3.11.0
this error log is shown.
npm ERR! code 1
npm ERR! path /Users/<username>/<path>/node_modules/sharp
npm ERR! command failed
npm ERR! command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
npm ERR! sharp: Detected globally-installed libvips v8.11.2
npm ERR! sharp: Building from source via node-gyp
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.14.0 | darwin | x64
npm ERR! gyp info find Python using Python version 3.7.0 found at "/Users/<username>/.pyenv/versions/3.7.0/bin/python3"
npm ERR! gyp info spawn /Users/<username>/.pyenv/versions/3.7.0/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/Users/<username>/.nodebrew/node/v15.14.0/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 '/Users/<username>/<path>/blog/node_modules/sharp/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/<username>/.nodebrew/node/v15.14.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/<username>/Library/Caches/node-gyp/15.14.0/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=/Users/<username>/Library/Caches/node-gyp/15.14.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/Users/<username>/.nodebrew/node/v15.14.0/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/<username>/Library/Caches/node-gyp/15.14.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/<username>/<path>/blog/node_modules/sharp',
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! Package OpenEXR was not found in the pkg-config search path.
npm ERR! Perhaps you should add the directory containing `OpenEXR.pc'
npm ERR! to the PKG_CONFIG_PATH environment variable
npm ERR! Package 'OpenEXR', required by 'vips', not found
npm ERR! gyp: Call to 'PKG_CONFIG_PATH="/usr/lib/pkgconfig:/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/11::/usr/local/opt/libffi/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig" pkg-config --cflags-only-I vips-cpp vips glib-2.0 | sed s\/-I//g' returned exit status 0 while 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 (/Users/<username>/.nodebrew/node/v15.14.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:369:20)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Darwin 20.5.0
npm ERR! gyp ERR! command "/Users/<username>/.nodebrew/node/v15.14.0/bin/node" "/Users/<username>/.nodebrew/node/v15.14.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /Users/<username>/<path>/blog/node_modules/sharp
npm ERR! gyp ERR! node -v v15.14.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
I tried brew reinstall vips but the error is not resloved. Does anybody have any idea what this is?
IDK why but ilmbase and OpenEXR have conflicting links.
This worked for me.
brew install openexr
brew unlink ilmbase
brew link openexr
brew install imath
brew link imath
I installed OpenEXR. I resloved this error.
https://github.com/AcademySoftwareFoundation/openexr/blob/master/INSTALL.md