任何我尝试安装的npm软件包,甚至只是npm安装本身,都会给我以下错误。
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
make: *** [Release/obj.target/node_expat/node-expat.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/myname/.npm-global/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:196:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:257:12)
gyp ERR! System Darwin 18.5.0
gyp ERR! command "/Users/myname/.npm-global/lib/node_modules/node/bin/node" "/Users/michaelteixeira/.npm-global/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/myname/Desktop/Portfolio/portfolio/node_modules/node-expat
gyp ERR! node -v v12.2.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-expat@2.3.17 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-expat@2.3.17 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
我已经尝试删除主目录中的node-gyp文件,从项目和json锁定文件中删除node_modules文件夹。我还尝试过卸载npm并重新安装它,以及重新启动Mac。
答案 0 :(得分:0)
您可以在以下位置看到拉取请求:https://github.com/astro/node-expat/pull/196。 我认为您正在使用Node12。可以将Node版本降级为10或8。 可能会出现一些警告,但是您可以成功安装节点扩展。 可能对您有用。