首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >错误/node_modules/node-sass:命令失败

错误/node_modules/node-sass:命令失败
EN

Stack Overflow用户
提问于 2020-02-25 20:07:28
回答 23查看 107.5K关注 0票数 105

当我尝试在本地安装vue store front,但是当我尝试使用"yarn install“命令时,我得到了以下错误。如何解决此错误?如何解决此错误?

代码语言:javascript
复制
error /var/www/html/vue-storefront/node_modules/node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments: 
Directory: /var/www/html/vue-storefront/node_modules/node-sass
Output:
Building: /usr/bin/node /var/www/html/vue-storefront/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   '/usr/bin/node',
gyp verb cli   '/var/www/html/vue-storefront/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library='
gyp verb cli ]
gyp info using node-gyp@3.8.0
gyp info using node@13.9.0 | linux | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "/usr/bin/python3.6" in the PATH
gyp verb `which` succeeded /usr/bin/python3.6 /usr/bin/python3.6
gyp ERR! configure error 
gyp ERR! stack Error: Command failed: /usr/bin/python3.6 -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack 
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:303:12)
gyp ERR! stack     at ChildProcess.emit (events.js:321:20)
gyp ERR! stack     at maybeClose (internal/child_process.js:1026:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
gyp ERR! System Linux 4.15.0-88-generic
gyp ERR! command "/usr/bin/node" "/var/www/html/vue-storefront/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /var/www/html/vue-storefront/node_modules/node-sass
gyp ERR! node -v v13.9.0
EN

回答 23

Stack Overflow用户

发布于 2020-06-21 14:53:58

我也遇到了同样的问题,将node-sass版本升级为与node版本相同。使用yarn只需运行:

代码语言:javascript
复制
yarn add node-sass

这将升级版本并修复问题

票数 113
EN

Stack Overflow用户

发布于 2021-05-12 16:29:35

我正在运行Rails 6,出于某种原因,它拉取的是webpacker 4.3.0,它拉取的是node-sass 4.3.0,而不是6.0.0,这是截至本文日期的最新版本。

对我来说起作用的是:

在删除node_module文件夹、package-lock.jsonrails/webpacker: 5.3.0.

  • I my package.json后,我升级了yarn install.

  • Then,然后重新运行了yarn add node-sass

Iyarn add node-sass

在尝试了上面的所有方法之后,这就像是一个护身符。

我相信这些步骤是准确的,尽管老实说,我已经尝试了太多的东西,但它们都不起作用,我最终让它起作用了,所以我可能遗漏了一步,但我尽了最大努力为任何未来受挫的灵魂重新创造它。

票数 26
EN

Stack Overflow用户

发布于 2020-05-06 18:14:55

只需在yarn.lock文件中升级您的sass版本即可。对于节点14,适用于node-sass的版本是4.14

因此要适应您节点版本。

票数 15
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60394291

复制
相关文章

相似问题

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