Hey everyone! I keep running into this frustrating issue whenever I try to install packages with npm on my Mac. The build process keeps failing and I can’t figure out what’s going wrong.
I’ve already tried a few different approaches like using the build-from-source flag and installing the gyp tools globally, but nothing seems to work. The error always happens when it tries to compile native modules.
Here’s what I’m seeing in my terminal:
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/configure.js:289:45)
gyp ERR! stack at ChildProcess.emit (events.js:198:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
gyp ERR! System Darwin 18.5.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/Users/johnsmith/Projects/react-app/node_modules/watchpack/lib/binding/Release/node-v72-darwin-x64/watcher.node" "--module_name=watcher" "--module_path=/Users/johnsmith/Projects/react-app/node_modules/watchpack/lib/binding/Release/node-v72-darwin-x64"
gyp ERR! cwd /Users/johnsmith/Projects/react-app/node_modules/watchpack
gyp ERR! node -v v10.16.2
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
make: *** [Release/obj.target/watcher/filewatcher.o] Error 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/watchpack):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node compile`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
added 892 packages from 521 contributors and audited 9834 packages in 52.14s
found 421 vulnerabilities (298 low, 98 moderate, 24 high, 1 critical)
run `npm audit fix` to fix them, or `npm audit` for details
Anyone know how to solve this problem?