当我尝试在本地安装 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
原文由 Adil 发布,翻译遵循 CC BY-SA 4.0 许可协议
我有同样的问题,我通过以下步骤解决了:
Rosetta 2
运行终端(可选,仅当您安装了 Rosetta 节点时才需要)node-sass
版本package.json
并与下表进行比较:节点JS支持的 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节点 <5.0 <57
node --version
node-sass
安装 Nodejs 版本,如果您使用的是 NVM,请运行:nvm use DESIRED_VERSION
rm -rf node_modules
npm install
资源: