node.js - npm install : Failed at the node-sass@3. 13.1 安装后脚本

标签 node.js angular npm npm-install node-sass

我有一个 Angular 应用程序:https://github.com/XBITSwitzerland/ngx-admin/tree/ng2-admin

现在我尝试这样做:npm install

但我得到这个错误(命令的竞争输出太长,所以我只在这里分享最后一部分):

gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\github\ngx-admin\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\github\\ngx-admin\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\github\ngx-admin\node_modules\wintersmith-sassy\node_modules\node-sass
gyp ERR! node -v v10.15.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Build failed with error code: 1
npm WARN ngx-toastr@4.4.1 requires a peer of @angular/core@^2.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-toastr@4.4.1 requires a peer of @angular/common@^2.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\watchpack\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@3.13.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@3.13.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\danyb\AppData\Roaming\npm-cache\_logs\2019-01-29T18_25_12_699Z-debug.log

有人知道为什么会出现此错误以及如何解决吗?

最佳答案

如果遇到此问题,请阅读此页面:https://www.bramvandenbulcke.be/en/kb/failed-node-sass3131-postinstall-script

我的解决方案:

1) 删除package-lock.json文件

2) npm install gulp-sass --save-dev

3) npm 安装 node-sass@latest

版本特定说明:

node-sass@3.13.1 仅在 Node.js 版本上运行,最高为 v7,如 release notes 中所述:

关于node.js - npm install : Failed at the node-sass@3. 13.1 安装后脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54427540/

相关文章:

javascript - 如何修复 fatal error : Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

html - 我必须设置打印布局。素材超出A4页

angular - 返回时如何跳过浏览器历史记录中的页面?

typescript - 将私有(private)包安装到 @types - TypeScript 和 NPM

javascript - 从外部静态 JSON 文件检索数据并在 AWS Lambda 中使用

javascript - CLI Node 应用程序中的堆栈溢出

node.js - 如何在 jetty/tomcat 上部署基于 "create-react-app"的应用程序

javascript - Musixmatch API 轨道搜索功能

mysql - NodeJS - 如何将 mysql 连接从主进程传递到子进程?

windows - Windows 7 中 Mocha 的代码覆盖率