Node-sass无法在Azure上编译

问题描述 投票:0回答:1

我已将我的React应用程序部署到Azure上,并且当前在加载网站时出现此编译错误:

./src/components/LoadingScreen/LoadingScreen.scss (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-5-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/lib/loader.js??ref--6-oneOf-5-3!./src/components/LoadingScreen/LoadingScreen.scss)
Error: Missing binding /home/site/wwwroot/node_modules/node-sass/vendor/linux-x64-64/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 10.x

Found bindings for the following environments:
  - Windows 64-bit with Node.js 10.x

This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass` to download the binding for your current environment.

我曾尝试在多个地方运行npm rebuild node-sass,但到目前为止还没有运气。发生这种情况是因为它是使用Windows构建的,但是已部署到Linux机器上?我该如何解决?

reactjs azure node-modules node-sass
1个回答
0
投票

如果注释不起作用,您也可以尝试在生产中进行构建后运行npm rebuild node-sass。我相信,如果将node-sass安装在单独的OS环境(即Windows / linux)中,则会在Docker容器中发生此错误。因此,您可以运行npm run start npm rebuild node-sass,使其在正确的环境中重建。

如果您确实要删除和重建,则在开发之前在产品环境中运行npm安装也可能很有用。

© www.soinside.com 2019 - 2024. All rights reserved.