Hi folks!
I recently ran into a new set of errors when executing npm install
on a fresh project. Maybe a different set of eyes can spot an error.
Environment:
- Node v12.21.0 → necessary due to limitations of Apple’s M1 chip (see here)
- NPM v7.17.0 → only npm versions 1, 2, and 7 will automatically install
peerDependencies
. Peer dependencies features are needed in my setup since I am developing a standalone Lisk Module.
npm ERR! code 1
npm ERR! path /Users/ahprivat/Developer/learning-lisk/node_modules/lisk-commander/node_modules/lisk-framework/node_modules/sodium-native
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! CC(target) Release/obj.target/sodium/binding.o
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@12.21.0 | darwin | x64
npm ERR! gyp info find Python using Python version 3.9.5 found at "/opt/homebrew/opt/python@3.9/bin/python3.9"
npm ERR! gyp info spawn /opt/homebrew/opt/python@3.9/bin/python3.9
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 '/Users/ahprivat/Developer/learning-lisk/node_modules/lisk-commander/node_modules/lisk-framework/node_modules/sodium-native/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 '/Users/ahprivat/Library/Caches/node-gyp/12.21.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/ahprivat/Library/Caches/node-gyp/12.21.0',
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=/Users/ahprivat/Library/Caches/node-gyp/12.21.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/ahprivat/Developer/learning-lisk/node_modules/lisk-commander/node_modules/lisk-framework/node_modules/sodium-native',
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! In file included from ../binding.c:5:
npm ERR! ../libsodium/src/libsodium/include/sodium.h:5:10: fatal error: 'sodium/version.h' file not found
npm ERR! #include "sodium/version.h"
npm ERR! ^~~~~~~~~~~~~~~~~~
npm ERR! 1 error generated.
npm ERR! make: *** [Release/obj.target/sodium/binding.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/local/lib/node_modules/npm/node_modules/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 Darwin 20.3.0
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 /Users/ahprivat/Developer/learning-lisk/node_modules/lisk-commander/node_modules/lisk-framework/node_modules/sodium-native
npm ERR! gyp ERR! node -v v12.21.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
Can someone with more experience tell me what the issue is? I feel it has something to do with npm 7
since this is not the version natively shipping with Node 12… Any thoughts?