首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >NPM node-sass安装失败

NPM node-sass安装失败
EN

Stack Overflow用户
提问于 2019-10-30 18:14:51
回答 5查看 32.8K关注 0票数 19

我正在尝试在一个项目中安装node-sass,它在我的pc上完美地构建和运行,但在我的表面上,我在尝试安装软件包时遇到了重大问题。

注意:我已经尝试了几次重新安装和重建项目。

错误摘要:

代码语言:javascript
复制
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\Max-T\Documents\Sources\StaffMangerV2\black-dashboard-pro-react-v1.0.0\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Max-T\\Documents\\Sources\\StaffMangerV2\\black-dashboard-pro-react-v1.0.0\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Users\Max-T\Documents\Sources\StaffMangerV2\black-dashboard-pro-react-v1.0.0\node_modules\node-sass
gyp ERR! node -v v12.13.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\react-scripts\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.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.11.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.11.0 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\Max-T\AppData\Roaming\npm-cache\_logs\2019-10-30T10_05_01_386Z-debug.log

package.json => https://hastebin.com/azetegukes.pl coode太多,所以我不得不将其粘贴到其他地方。

EN

回答 5

Stack Overflow用户

回答已采纳

发布于 2019-10-31 08:06:57

您使用的是Node12,并且node-sass需要至少为4.12才能支持该版本的https://github.com/sass/node-sass#node-version-support-policy

票数 26
EN

Stack Overflow用户

发布于 2021-12-12 13:25:58

如果最近有人遇到这种情况...最简单的修复方法是将依赖项中的节点-sass替换为sass。它是最近维护的版本,我只需要更改一行代码就可以初始化它,并且我现有的所有代码都已经兼容。

https://sass-lang.com/blog/libsass-is-deprecated的How to migrate下有更多详细信息。

票数 9
EN

Stack Overflow用户

发布于 2020-04-28 17:25:25

试试这个命令,它对我很有效

代码语言:javascript
复制
sudo npm install -g --unsafe-perm node-sass
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58623072

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档