当我尝试在我的本地安装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

当前回答

在阅读了heroku的日志后,得到了非常奇怪的解决方案。

最初,我按照这个顺序添加了构建包: heroku / ruby heroku / nodejs

但在查看完整的日志和错误后,我已经改变了顺序: heroku / nodejs heroku / ruby

在此之后,预编译工作得很好。

其他回答

我的解决方案使用节点v10.19.0

https://github.com/nodejs/docker-node/issues/1149#issuecomment-552705885

Had a similar problem with /node_modules/node-sass: Command failed on building my application, which also occurred within the last week without any updates on my end. Had a look at the node-sass docs and the node version on the server and it was using node v12.13.0 and the version of node-sass was 4.9.x. in the node-sass release docs it lists that for node v12 you need to have node-sass v4.12 and up. Updating node-sass version corrected the build for me, hope it helps for you too. node Release docs: https://github.com/sass/node-sass/releases

通过gulp,我得到了“Node Sass无法为您的当前环境找到绑定:Linux 64位的Node.js 12.x

为以下环境找到绑定:

Linux 64位,不支持运行时(93)

这通常是因为运行npm install后环境发生了变化。 运行npm rebuild node-sass下载当前环境的绑定。

所以我运行了npm rebuild node-sass,结果成功了!然后安装npm,一切正常。

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

对我有效的方法如下:

删除node_module文件夹,package-lock。Json和yarn.lock 在我的包裹里。我升级了rails/webpacker: 5.3.0。 然后我重新运行纱线安装。 然后我运行yarn add node-sass

在尝试了以上所有方法之后,这个方法非常有效。

我相信这些是确切的步骤,尽管说实话,我已经尝试了很多事情,他们没有工作,我终于得到了它的工作,所以有可能我可能错过了一个步骤,但我尽了最大的努力为任何未来沮丧的灵魂重新创造它。

我现在在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

见:https://github.com/rails/webpacker升级

chase439的道具:https://github.com/sass/node-sass/issues/2447

用yarn全局安装node-sass

或 将node-sass添加到项目中