Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MAC npm install issue with gyp

I was trying to install the npm, but I keep getting this error that I think is related to the hummus module:

npm WARN deprecated [email protected]: Please update to ini >=1.3.6 to avoid a prototype pollution issue
npm ERR! code 1
npm ERR! path /Users/abcd/Desktop/project/project_l_api/node_modules/hummus
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 [email protected]
npm ERR! gyp info using [email protected] | darwin | x64
npm ERR! gyp info find Python using Python version 3.9.1 found at "/usr/local/opt/[email protected]/bin/python3.9"
npm ERR! gyp info spawn /usr/local/opt/[email protected]/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/abcd/Desktop/project/project_l_api/node_modules/hummus/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/abcd/Library/Caches/node-gyp/15.8.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/abcd/Library/Caches/node-gyp/15.8.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/abcd/Library/Caches/node-gyp/15.8.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/abcd/Desktop/project/project_l_api/node_modules/hummus',
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:378:20)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Darwin 19.6.0
npm ERR! gyp ERR! command "/usr/local/Cellar/node/15.8.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /Users/abcd/Desktop/project/project_l_api/node_modules/hummus
npm ERR! gyp ERR! node -v v15.8.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok

Also noticed that sometimes the error message indicates the issue with sqlite3 instead of hummus.

Could not get an exact clue to start, I tried to reinstall the npm and the gyp but the problem still persists.

like image 951
gangdou Avatar asked Feb 16 '21 08:02

gangdou


People also ask

Does NPM install work on Mac?

You should have some familiarity with the Mac Terminal application since you'll need to use it to install and test Node and NPM. You'll also need the Terminal to use Node. js and NPM. The Terminal application is located in the Utilities folder in the Applications folder.

Should I install node-gyp globally?

It is good to install the node-gyp globally because main purpose of the node-gyp is to build the node native modules. node-gyp also need some tool like visual studio (in case of building on Windows) and python which also installed globally.

Why is NPM install failing?

The error in NPM, 'error package install failed, see above', can occur when the user creates a new project in Angular using Node. js using VS code. This means that NPM is corrupted in your system, and must reinstall NPM.


Video Answer


1 Answers

run npm update and npm install after. it worked for me.

like image 84
DavidA Avatar answered Oct 23 '22 12:10

DavidA