在node-sass@4.7.2 postinstall脚本

时间:2018-05-27 13:54:03

标签: node.js npm sass node-sass

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

  

在post-sass@4.7.2 postinstall脚本失败。

我尝试过: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和节点版本是:

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

我还尝试完全删除我的node_modules文件夹并再次运行npm install,但这不起作用。

一个可能的原因可能是之前我更新了节点I后面跟着这个人的建议:https://github.com/angular/angular-cli/issues/10527

他说:

  
      
  1. 下载并保存node-sass的正确版本的本地副本   binary - win32-x64-64_binding.node。例如,将其下载到   以下位置:C:\ node-sass \ win32-x64-64_binding.node
  2.   
  3. 提供   引用中的node-sass二进制文件的完整路径   sass_binary_path npm配置参数(在〜/ .npmrc文件中):   npm config set sass_binary_path For   例如,npm config set sass_binary_path   C:\ node-sass \ win32-x64-64_binding.node
  4.   
  5. 运行npm install命令   再次正确安装@ angular / cli。
  6.   
  7. 执行ng serve或npm start   你应该解决问题。
  8.   

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

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

6 个答案:

答案 0 :(得分:3)

从node_modules中仅删除node-sass文件夹并运行以下命令

npm install node-sass@4.7.2 --save

答案 1 :(得分:3)

尝试

npm audit
npm audit fix

答案 2 :(得分:2)

不需要做很多事情,您正面临着这个问题,因为您在尝试安装npm sass@4.7.2时不知道它是否与pm版本兼容,因此最好的解决方案是编写下述命令 npm install --save-dev节点-sass 这将在您的系统上安装与您拥有的npm版本兼容的npm sass。 谢谢,待会我 首先,运行命令

答案 3 :(得分:0)

尝试使用此标记--unsafe-perm=true

运行
npm i node-sass --unsafe-perm=true

答案 4 :(得分:0)

尝试检查您的Node版本。也许您使用的是错误的版本。使用NVM进行版本管理。

答案 5 :(得分:-1)

我遇到了同样的问题,我通过阅读该库版本的文档找到了解决方案,他们建议应该使用哪些版本的节点来安装该依赖项。就我而言,我使用“nvm”更改为节点版本9.11.2,然后运行命令“npm i”。 >

https://github.com/sass/node-sass/releases?after=v4.8.0

documentation node-sass 4.7.2