nodejs / node-gyp

Node.js native addon build tool
MIT License
9.89k stars 1.79k forks source link

`gyp` failed with exit code: 1 #2589

Open maximilianbiebl opened 2 years ago

maximilianbiebl commented 2 years ago

I'm building an MagicMirror on my Raspberry3B. While installing some modules I've recieved the 'gyp' failed with exit code: 1 error. I've tried multiple solutions but none of these worked for me.

This is the full Error code in my Terminal:

npm ERR! code 1
npm ERR! path /home/pi/MagicMirror/modules/MMM-MessageToMirror/node_modules/grpc
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@8.3.0
npm ERR! gyp info using node@16.13.2 | linux | arm
npm ERR! gyp info find Python using Python version 3.9.2 found at "/usr/bin/python3"
npm ERR! gyp http GET https://nodejs.org/download/release/v16.13.2/node-v16.13.2-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.13.2/node-v16.13.2-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v16.13.2/SHASUMS256.txt
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.13.2/SHASUMS256.txt
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/home/pi/.config/nvm/versions/node/v16.13.2/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/pi/MagicMirror/modules/MMM-MessageToMirror/node_modules/grpc/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/pi/.config/nvm/versions/node/v16.13.2/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/pi/.cache/node-gyp/16.13.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=/home/pi/.cache/node-gyp/16.13.2',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/home/pi/.config/nvm/versions/node/v16.13.2/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/pi/.cache/node-gyp/16.13.2/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/pi/MagicMirror/modules/MMM-MessageToMirror/node_modules/grpc',
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 (/home/pi/.config/nvm/versions/node/v16.13.2/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:261:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Linux 5.10.63-v7+
npm ERR! gyp ERR! command "/home/pi/.config/nvm/versions/node/v16.13.2/bin/node" "/home/pi/.config/nvm/versions/node/v16.13.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /home/pi/MagicMirror/modules/MMM-MessageToMirror/node_modules/grpc
npm ERR! gyp ERR! node -v v16.13.2
npm ERR! gyp ERR! node-gyp -v v8.3.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2022-01-14T12_14_51_317Z-debug.log

Does anyone know what I need to do?

alexander-milenko commented 2 years ago

@maximilianbiebl any progress about this?

I have similar with

error /usr/src/project/node_modules/sharp: Command failed.
Exit code: 1
Command: (node install/libvips && node install/dll-copy && prebuild-install --runtime=napi) || (node-gyp rebuild && node install/dll-copy)
Arguments: 
Directory: /usr/src/project/node_modules/sharp
Output:
info sharp Detected globally-installed libvips v8.12.1
info sharp Building from source via node-gyp
gyp info it worked if it ends with ok
gyp info using node-gyp@8.4.1
gyp info using node@17.4.0 | linux | x64
gyp info find Python using Python version 3.9.7 found at "/usr/bin/python3"
gyp http GET https://unofficial-builds.nodejs.org/download/release/v17.4.0/node-v17.4.0-headers.tar.gz
gyp http 200 https://unofficial-builds.nodejs.org/download/release/v17.4.0/node-v17.4.0-headers.tar.gz
gyp http GET https://unofficial-builds.nodejs.org/download/release/v17.4.0/SHASUMS256.txt
gyp http 200 https://unofficial-builds.nodejs.org/download/release/v17.4.0/SHASUMS256.txt
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/src/project/node_modules/sharp/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/root/.cache/node-gyp/17.4.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/root/.cache/node-gyp/17.4.0',
gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/17.4.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/usr/src/project/node_modules/sharp',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/usr/src/project/node_modules/sharp/build'
make: printf: Operation not permitted
make: *** [../node-addon-api/nothing.target.mk:109: Release/obj.target/nothing/../node-addon-api/nothing.o] Error 127
make: Leaving directory '/usr/src/project/node_modules/sharp/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:520:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Linux 4.19.130-boot2docker
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/src/project/node_modules/sharp
gyp ERR! node -v v17.4.0
gyp ERR! node-gyp -v v8.4.1
gyp ERR! not ok
maximilianbiebl commented 2 years ago

@alexander-milenko No, I have nothing new so far.

cclauss commented 2 years ago

Two separate issues...

npm ERR! gyp: Undefined variable module_name in binding.gyp while trying to load binding.gyp

Please look in the binding.gyp and see if there is an undefined variable named module_name.

make: Entering directory '/usr/src/project/node_modules/sharp/build' make: printf: Operation not permitted make: *** [../node-addon-api/nothing.target.mk:109: Release/obj.target/nothing/../node-addon-api/nothing.o] Error 127 make: Leaving directory '/usr/src/project/node_modules/sharp/build'

You might try to post an issue at https://github.com/lovell/sharp

vignesk70 commented 2 years ago

I got this error on MacOS 12.3 beta

npm ERR! gyp info using node-gyp@3.8.0

npm ERR! path /Users/vignes/Downloads/nuxt-black-dashboard-master/node_modules/node-sass

Both of these issues are discussed at: https://github.com/nodejs/node-gyp/tree/master/docs#readme