node.js - 在 node-expat@2.3.17 安装脚本失败 - 任何 NPM 安装都会发生
问题描述
我尝试安装的任何 npm 包,甚至只是 npm install 本身都会给我以下错误。
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/name/.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。
解决方案
您可以在此处查看拉取请求:https ://github.com/astro/node-expat/pull/196 。我认为您使用的是 Node 12。您可以将 Node 版本降级到 10 或 8。可能会出现一些警告,但您可以安装 node-expat 成功。可能对你有用。
推荐阅读
- java - 已关闭 - EntityManager + Spring Batch + 在块处理器期间无法合并
- javascript - 将张量转换为数组 - Tensorflow JS
- kubernetes - 在 Kubernetes 中,我怎样才能有一个硬性的最小数量的 pod 来部署?
- python - DASH 下拉菜单和图表
- html - Angular styles from styles.scss are not always being applied
- mongodb - KMongo 创建多个连接
- sql - R Reticulate 函数返回 SQL 数值为
对象 - html - 如何使内容的列随图像大小缩放?
- javascript - Javascript从字符串更新对象
- python - Django/Wagtail:django-debug-toolbar 在面板上点击时出现 404 错误