npm install:在 node-sass@3.13.1 安装后脚本失败

新手上路,请多包涵

我有一个角度应用程序: 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

有人知道为什么会发生此错误以及如何解决它吗?

原文由 BlockchainProgrammer 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 979
2 个回答

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

在我的情况下的解决方案:

1)删除 package-lock.json 文件

  1. npm install gulp-sass --save-dev

  2. npm install node-sass@latest

版本特定说明:

node-sass@3.13.1 仅在版本 说明 中所述的 Node.js 最高 v7 版本上运行:

原文由 BlockchainProgrammer 发布,翻译遵循 CC BY-SA 4.0 许可协议

我认为发生这种情况是因为您缺少 node-sass 模块。尝试以下操作并重新运行您的构建脚本,看看是否可以解决您的问题:

 npm install node-sass@latest

另外,我看到你在 Windows 平台上使用 fsevents ,只是一个警告,这个模块只支持对 OS X FSEvents 的本机访问

原文由 Nathan 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进