【问题标题】:React Project - Node sass could not find a binding for your current environmentReact Project - Node sass 找不到当前环境的绑定
【发布时间】:2020-08-01 14:57:17
【问题描述】:

我正在使用 React

“反应”:“^16.13.1”,

我想使用 Sass,所以我安装了 Node-sass:

"node-sass": "^4.13.1",

我有这个错误:

我尝试解决如下:

npm 重建节点-sass 我删除了 node-modules 文件夹并再次运行 npm i

但错误仍然存​​在

我将节点版本更新为:

v13.13.0

再来一次

此应用有一个 dockerfile,其中包含:

FROM 节点:13-alpine

【问题讨论】:

  • 首先清除缓存 npm clean cahce 。如果没有解决,请卸载 node js 并重新安装最新版本。也尝试使用另一台机器

标签: node.js reactjs node-modules node-sass


【解决方案1】:

您不能在 Mac 上安装,然后与 Alpine(或任何其他)Docker 容器共享 node_modules 文件夹。如果您使用任何原生模块(如 node-sass),请在容器内安装。

【讨论】:

  • 我试过了,但它不起作用。在容器内部,我运行了 npm install 和 npm install node-sass。我还使用 node_modules 文件夹创建了 .dockerignorefile,但我在主机中运行了 npm i 并且该文件夹被复制到容器中
猜你喜欢
  • 2016-10-25
  • 2019-10-12
  • 2021-04-06
  • 2017-04-15
  • 1970-01-01
  • 2022-07-19
  • 2021-02-19
  • 2019-08-29
  • 2022-06-14
相关资源
最近更新 更多