Node-sass 未在 Azure 上编译
Node-sass not compiling on Azure
我已经将我的 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 机器上吗?我该如何解决这个问题?
如果评论的答案不起作用,您也可以在构建后尝试 运行ning npm rebuild node-sass。如果 node-sass 安装在单独的 OS 环境中(即 windows/linux),我认为此错误会发生在 Docker 容器中。所以你可以 运行 npm run start npm rebuild node-sass
让它在正确的环境中重建。
如果您确实删除并重建,它也可能对 运行 在您的生产环境中安装 npm 有用,然后再进行开发。
只需删除node_modules
下的node-sass
文件夹,然后执行npm install
我已经将我的 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 机器上吗?我该如何解决这个问题?
如果评论的答案不起作用,您也可以在构建后尝试 运行ning npm rebuild node-sass。如果 node-sass 安装在单独的 OS 环境中(即 windows/linux),我认为此错误会发生在 Docker 容器中。所以你可以 运行 npm run start npm rebuild node-sass
让它在正确的环境中重建。
如果您确实删除并重建,它也可能对 运行 在您的生产环境中安装 npm 有用,然后再进行开发。
只需删除node_modules
下的node-sass
文件夹,然后执行npm install