node.js - 在 node-sass@4.7.2 安装后脚本失败

标签 node.js npm sass node-sass

我刚刚下载了最新版本的 node.js 并且我一直在尝试在我的一个项目上执行 npm install 但说:

Failed at the node-sass@4.7.2 postinstall script.

我尝试过这样做: npm rebuild node-sass --force 也没有做任何事情。

enter image description here

错误日志返回:

3209 warn angularfire2@5.0.0-rc.10 requires a peer of @angular/common@^6.0.0 
but none is installed. You must install peer dependencies yourself.
3210 warn angularfire2@5.0.0-rc.10 requires a peer of @angular/core@^6.0.0 but none is installed. You must install peer dependencies yourself.
3211 warn angularfire2@5.0.0-rc.10 requires a peer of @angular/platform-browser@^6.0.0 but none is installed. You must install peer dependencies yourself.
3212 warn angularfire2@5.0.0-rc.10 requires a peer of @angular/platform-browser-dynamic@^6.0.0 but none is installed. You must install peer dependencies yourself.
3213 warn angularfire2@5.0.0-rc.10 requires a peer of firebase@^5.0.3 but none is installed. You must install peer dependencies yourself.
3214 warn angularfire2@5.0.0-rc.10 requires a peer of rxjs@^6.0.0 but none is installed. You must install peer dependencies yourself.
3215 warn geofire@4.1.2 requires a peer of firebase@^2.4.0 || 3.x.x but none is installed. You must install peer dependencies yourself.
3216 warn optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
3217 warn notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
3218 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS:    darwin
3218 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch:  any
3218 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS:   win32
3218 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
3219 verbose stack Error: node-sass@4.7.2 postinstall: `node scripts/build.js`
3219 verbose stack Exit status 1
3219 verbose stack     at EventEmitter.<anonymous> (C:\Users\Simon K\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:283:16)
3219 verbose stack     at emitTwo (events.js:126:13)
3219 verbose stack     at EventEmitter.emit (events.js:214:7)
3219 verbose stack     at ChildProcess.<anonymous> (C:\Users\Simon K\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
3219 verbose stack     at emitTwo (events.js:126:13)
3219 verbose stack     at ChildProcess.emit (events.js:214:7)
3219 verbose stack     at maybeClose (internal/child_process.js:925:16)
3219 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
3220 verbose pkgid node-sass@4.7.2
3221 verbose cwd C:\xampp\htdocs\project x\projectx
3222 verbose Windows_NT 10.0.16299
3223 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Simon K\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
3224 verbose node v8.11.2
3225 verbose npm  v6.0.1
3226 error code ELIFECYCLE
3227 error errno 1
3228 error node-sass@4.7.2 postinstall: `node scripts/build.js`
3228 error Exit status 1
3229 error Failed at the node-sass@4.7.2 postinstall script.
3229 error This is probably not a problem with npm. There is likely additional logging output above.
3230 verbose exit [ 1, true ]

我的 npm 和 Node 版本是:

2 info using npm@6.0.1
3 info using node@v8.11.2

我也尝试过完全删除我的 node_modules 文件夹并再次运行 npm install 但没有奏效。

一个可能的原因可能是之前我更新了 Node 我遵循了这个人的建议:https://github.com/angular/angular-cli/issues/10527

他说的地方:

  1. Download and save a local copy of the correct version of node-sass binary - win32-x64-64_binding.node. For example download it to the following location: C:\node-sass\win32-x64-64_binding.node
  2. Provide reference to the full path of the node-sass binary file in the sass_binary_path npm configuration parameter (in the ~/.npmrc file): npm config set sass_binary_path For example, npm config set sass_binary_path C:\node-sass\win32-x64-64_binding.node
  3. Run the npm install command again to install @angular/cli correctly.
  4. Execute ng serve or npm start and your should be past the problem.

我不知道这是否相关。我不这么认为,因为我已经更新了 Node ,试图强制 node-sass 重建但我不知道。

关于如何解决此问题的任何想法/建议?谢谢!

最佳答案

试试这个

npm audit
npm audit fix

关于node.js - 在 node-sass@4.7.2 安装后脚本失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50552834/

相关文章:

css - SASS 中@use 和@forward 有什么区别?

node.js - 如何使用 Kubernetes 和 Gitlab CI/CD 在 Google Cloud Platform 中部署暂存?

javascript - 如何在 Html5、JavaScript、Css、Sass 中实现随机按钮颜色生成器

node.js - 使用nodejs抓取网页返回URL

Node.js 版本和 Google Cloud 功能

node.js - 如何解决返回 ENOAUDIT : Your configured registry does not support audit requests? 的 npm 审计

node.js - 安装 create-react-app my-first-react-app 后 npm start 脚本立即返回错误

css - 如何引用父对象但在 sass 中附加标签?

node.js - 使用 babel 和 Jest 在 ES2017 中导入意外 token

node.js - Mongoose findOneAndUpdate 嵌套文档