I’m encountering an error when trying to install packages for my Node.js application on macOS.
While executing the installation command, it fetches the packages without issue, but fails during the compilation phase. The failure occurs specifically with a package called [email protected] that requires native code to be compiled.
This is the primary error message that appears:
npm ERR! error installing [email protected]
The complete output indicates:
myuser$ npm install
npm http GET https://registry.npmjs.org/lodash
npm http 304 https://registry.npmjs.org/lodash
npm http GET https://registry.npmjs.org/cheerio
npm http GET https://registry.npmjs.org/xml-parser
npm http 304 https://registry.npmjs.org/xml-parser
npm WARN [email protected] package.json: repository['web'] should probably be repository['url']
npm http 304 https://registry.npmjs.org/cheerio
npm http GET https://registry.npmjs.org/css-select
npm http GET https://registry.npmjs.org/webview-context
npm http 304 https://registry.npmjs.org/css-select
npm http 304 https://registry.npmjs.org/webview-context
> [email protected] preinstall /Users/myuser/Projects/music-app/node_modules/lodash/node_modules/cheerio/node_modules/webview-context
> node-gyp clean || (exit 0); node-gyp configure build
Nothing to clean (project not configured)
Setting srcdir to : /Users/myuser/Projects/music-app/node_modules/lodash/node_modules/cheerio/node_modules/webview-context
Setting blddir to : /Users/myuser/Projects/music-app/node_modules/lodash/node_modules/cheerio/node_modules/webview-context/build
Checking for program g++ or c++ : not found
/Users/myuser/Projects/music-app/node_modules/lodash/node_modules/cheerio/node_modules/webview-context/binding.gyp:8: error: could not configure a cxx compiler!
npm ERR! error installing [email protected]
npm ERR! error installing [email protected]
npm ERR! error installing [email protected]
npm ERR! [email protected] preinstall: `node-gyp clean || (exit 0); node-gyp configure build`
npm ERR! `sh "-c" "node-gyp clean || (exit 0); node-gyp configure build"` failed with 1
npm ERR!
npm ERR! Failed at the [email protected] preinstall script.
npm ERR! This is most likely a problem with the webview-context package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp clean || (exit 0); node-gyp configure build
npm ERR! You can get their info via:
npm ERR! npm owner ls webview-context
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Darwin 11.2.0
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Users/myuser/Projects/music-app
npm ERR! node -v v0.8.12
npm ERR! npm -v 1.2.14
npm ERR! code ELIFECYCLE
npm ERR! message [email protected] preinstall: `node-gyp clean || (exit 0); node-gyp configure build`
npm ERR! message `sh "-c" "node-gyp clean || (exit 0); node-gyp configure build"` failed with 1
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/myuser/Projects/music-app/npm-debug.log
npm not ok
I am using macOS with Xcode installed. Many solutions I found are catered towards Windows, but I need assistance specific to macOS. Could anyone provide suggestions for resolving this issue?