【问题标题】:Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 12.xNode Sass 找不到当前环境的绑定:Linux 64-bit with Node.js 12.x
【发布时间】:2022-07-19 11:43:09
【问题描述】:


当我开始将 CSS 文件扩展名更改为 scss 并安装 node-sass 模块时,我遇到了以下问题:

Error: Missing binding /home/shayan/workspace/react-ts-seed/node_modules/node-sass/vendor/linux-x64-72/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 12.x

Found bindings for the following environments:
  - Unknown environment (.DS_Store)
  - OS X 64-bit with Node.js 17.x
  - Linux 64-bit with Node.js 14.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.

在删除 node_module 并再次安装整个模块以及执行 npm rebuild node-sass 之后什么都没有发生。

我的 node-sass 版本是 node-sass@7.0.1

【问题讨论】:

    标签: css reactjs typescript sass


    【解决方案1】:

    这是一个常见的 node-sass 版本与 Node 版本的兼容性问题。

    重复问题: https://stackoverflow.com/a/59025839/1708333

    快速破解:

    卸载并重新安装node-sass,它会为自己找到丢失的二进制文件。

    npm uninstall --save-dev node-sass
    npm install --save-dev node-sass
    

    永久解决方案:

    如果使用上述命令无法解决问题,则可能是您的节点版本有问题。检查您的节点版本是否支持 node-sass 版本。选择一个稳定的节点版本并重复上面的命令来解决这个问题。

    下面是该节点与node-sass的兼容性表:-

    NodeJS | Supported node-sass version | Node Module
    Node 17     7.0+                        102
    Node 16     6.0+                        93
    Node 15     5.0+                        88
    Node 14     4.14+                       83
    Node 13     4.13+, <5.0                 79
    Node 12     4.12+                       72
    Node 11     4.10+, <5.0                 67
    Node 10     4.9+, <6.0                  64
    Node 8      4.5.3+, <5.0                57
    Node <8     <5.0                        <57
    

    如果问题仍未解决,请查看 node-sass 支持的环境列表:- https://github.com/sass/node-sass/releases/

    【讨论】:

      猜你喜欢
      • 2021-02-19
      • 2021-04-06
      • 1970-01-01
      • 2017-04-15
      • 1970-01-01
      • 2016-09-16
      • 2021-02-15
      • 2018-10-22
      • 1970-01-01
      相关资源
      最近更新 更多