当我尝试在我的本地安装vue商店前,但当我尝试“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

当前回答

这发生在我升级节点的一天后。我不得不恢复到低节点版本。我已经从14.15.4升级到16.13.2

其他回答

用yarn全局安装node-sass

或 将node-sass添加到项目中

失败是因为这里使用了python3。创建一个.npmrc文件 项目文件夹包含python = "/usr/bin/python2.7"和安装。 根据链接,python 3.x。尚不支持X。——NaceurBouhamed 2月25日20日12:28

python=“localpath/python27/python.exe”

解决

这里的解决方案对我不起作用。 直到我删除node_modules文件夹和yarn.lock。

rm -rf node_modules
rm yarn.lock
yarn instal

这里也有同样的问题。我所做的

nvm install 14  

因为我包里有node-sass版本。Json是4.14.1 现在使用节点v14.19.3 (npm v6.14.17) 在我之后

yarn install

这是成功的

TBH,我的问题是我试图“npm install angular-cli”而不是“npm install @angular/cli”,希望这能帮助其他像我一样的傻瓜:)