Adi*_*dil 64 node.js vue.js yarnpkg
当我尝试在本地安装 vue store front 但当我尝试“yarn install”命令时,出现以下错误。我该如何解决这个错误?我该如何解决这个错误?
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
Run Code Online (Sandbox Code Playgroud)
小智 86
我遇到了同样的问题,将 node-sass 版本升级为与 node 版本相同。用纱线运行:
yarn add node-sass
Run Code Online (Sandbox Code Playgroud)
这将升级版本并解决问题
Âng*_*tto 39
我遇到了同样的问题,我通过以下步骤解决了:
Rosetta 2(可选,仅当您安装了 Rosetta 的节点时才需要)node-sass版本package.json并与下表进行比较:| 节点 | 支持的 node-sass 版本 | 节点模块 |
|---|---|---|
| 节点 16 | 6.0+ | 93 |
| 节点 15 | 5.0+ | 88 |
| 节点 14 | 4.14+ | 83 |
| 节点 13 | 4.13+,<5.0 | 79 |
| 节点 12 | 4.12+ | 72 |
| 节点 11 | 4.10+,<5.0 | 67 |
| 节点 10 | 4.9+,<6.0 | 64 |
| 节点 8 | 4.5.3+,<5.0 | 57 |
| 节点 <8 | <5.0 | <57 |
node-sassrm -rf node_modulesnpm install资源:
tro*_*rta 27
如果它是一个 Rails 项目,升级 webpacker 就可以帮我完成这项工作。
yarn add @rails/webpacker
Run Code Online (Sandbox Code Playgroud)
mar*_*ion 18
我正在跑步Rails 6,出于某种原因,它正在拉动webpacker 4.3.0哪个正在拉动,node-sass 4.3.0而不是6.0.0截至本文发布之日最新的那个。
对我有用的是以下内容:
node_module文件夹,package-lock.json以及yarn.lockpackage.json,我升级了rails/webpacker: 5.3.0。yarn install。yarn add node-sass在尝试了上述所有其他方法之后,这就像一种魅力。
我相信这些是确切的步骤,虽然老实说我一直在尝试很多东西,但它们没有奏效,我终于让它起作用了,所以我可能错过了一步,但我尽力了为任何未来受挫的灵魂重新创造它。
小智 10
这里的解决方案对我不起作用。直到我删除node_modules文件夹和yarn.lock。
rm -rf node_modules
rm yarn.lock
yarn instal
Run Code Online (Sandbox Code Playgroud)
小智 7
这里有同样的问题。我做到了
nvm install 14
Run Code Online (Sandbox Code Playgroud)
因为node-sass我的版本是package.json然后4.14.1
这将显示 - 现在使用node v14.19.3( npm v6.14.17) 在我这样做之后
yarn install
Run Code Online (Sandbox Code Playgroud)
这是成功的
小智 6
尝试安装 sass 而不是 node-sass。它对我有用。
yarn remove node-sass
yarn add sass
Run Code Online (Sandbox Code Playgroud)
小智 6
我在 Rails 应用程序上遇到同样的问题已经有一段时间了,并通过升级 webpacker 解决了:
# check your Gemfile for version restrictions
bundle update webpacker
# overwrite your changes to the default install files and revert any unwanted changes from the install
rails webpacker:install
# yarn 1 instructions
yarn upgrade @rails/webpacker --latest
yarn upgrade webpack-dev-server --latest
Run Code Online (Sandbox Code Playgroud)
请参阅: https: //github.com/rails/webpacker#upgrading
chase439 的道具:https ://github.com/sass/node-sass/issues/2447
面临同样的问题。如果您查看错误堆栈,它会说:
Error: Command failed: /usr/bin/python3.6 -c import sys; print "%s.%s.%s" % sys.version_info[:3];
File "<string>", line 1
import sys; print "%s.%s.%s" % sys.version_info[:3];
^
SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)
它试图使用 Python2,但使用不受支持的 Python3。
我的系统在使用python命令调用时运行 Python3 ,因此我通过安装 Python2 并将其别名为python命令来解决此问题:
Error: Command failed: /usr/bin/python3.6 -c import sys; print "%s.%s.%s" % sys.version_info[:3];
File "<string>", line 1
import sys; print "%s.%s.%s" % sys.version_info[:3];
^
SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)
我的解决方案使用节点 v10.19.0
https://github.com/nodejs/docker-node/issues/1149#issuecomment-552705885
/node_modules/node-sass 也有类似的问题:构建我的应用程序时命令失败,这也发生在上周,而我这边没有任何更新。
查看了node-sass文档和服务器上的node版本,它使用的是node v12.13.0,node-sass的版本是4.9.x。
在node-sass发行文档中,它列出了对于node v12,您需要有node-sass v4.12及更高版本。
更新node-sass版本为我纠正了构建,希望它对你也有帮助。
节点发布文档: https: //github.com/sass/node-sass/releases
| 归档时间: |
|
| 查看次数: |
70314 次 |
| 最近记录: |