运行ning npm 运行 build 时如何修复 'Node Sass could not find a binding in your current env.'
How to fix 'Node Sass could not find a binding in your current env.' when running npm run build
我是 运行 sudo npm run build
,它说找不到 sass 的绑定。我目前只安装了一个版本的 npm,它是 11.13.0
我试过了
npm install node-sass
,
npm rebuild node-sass
,
npm uninstall -save node-sass
,
npm install -save node-sass
,
npm cache clean
,删除了完整的节点和 node_modules 文件夹,但仍然出现相同的错误。但是我确实安装了 8.0.0 版,但我使用 nvm
删除了它
ERROR in ./src/main/webapp/styles/styles.scss (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/sass-loader/lib/loader.js??ref--14-3!./src/main/webapp/styles/styles.scss)
Module build failed (from ./node_modules/sass-loader/lib/loader.js):
Error: Missing binding /home/dev/IdeaProjects/web-project/node_modules/node-sass/vendor/linux-x64-57/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 8.x
Found bindings for the following environments:
- Linux 64-bit with Node.js 11.x
如果您需要任何其他信息,请告诉我。
尝试命令:sudo npm install --save-dev --unsafe-perm node-sass
对我有用
这是因为您项目中使用的节点版本与您全局安装的节点版本不匹配。
- 查看您的项目 package.json
中指示的节点版本
- 将版本更改为所需的节点版本
- 通过在您的项目目录中执行
npm clean-install
来清除项目的 node_modules 文件夹
- 发出
npm install
重新安装所有软件包
- 使用:
node -v
确定您激活的节点版本。如果输出的版本与您在项目中设置的版本匹配,您的 npm run build
命令将起作用。如果它们不匹配,您将必须安装匹配版本的节点,或者如果您使用的是 nvm,请使用:nvm use <version>
激活匹配版本。
解决我的相同问题的唯一方法是删除所有 node_modules 并重新安装它们,并且在 React 中一切正常。
我是 运行 sudo npm run build
,它说找不到 sass 的绑定。我目前只安装了一个版本的 npm,它是 11.13.0
我试过了
npm install node-sass
,
npm rebuild node-sass
,
npm uninstall -save node-sass
,
npm install -save node-sass
,
npm cache clean
,删除了完整的节点和 node_modules 文件夹,但仍然出现相同的错误。但是我确实安装了 8.0.0 版,但我使用 nvm
ERROR in ./src/main/webapp/styles/styles.scss (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/sass-loader/lib/loader.js??ref--14-3!./src/main/webapp/styles/styles.scss)
Module build failed (from ./node_modules/sass-loader/lib/loader.js):
Error: Missing binding /home/dev/IdeaProjects/web-project/node_modules/node-sass/vendor/linux-x64-57/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 8.x
Found bindings for the following environments:
- Linux 64-bit with Node.js 11.x
如果您需要任何其他信息,请告诉我。
尝试命令:sudo npm install --save-dev --unsafe-perm node-sass
对我有用
这是因为您项目中使用的节点版本与您全局安装的节点版本不匹配。
- 查看您的项目 package.json 中指示的节点版本
- 将版本更改为所需的节点版本
- 通过在您的项目目录中执行
npm clean-install
来清除项目的 node_modules 文件夹 - 发出
npm install
重新安装所有软件包 - 使用:
node -v
确定您激活的节点版本。如果输出的版本与您在项目中设置的版本匹配,您的npm run build
命令将起作用。如果它们不匹配,您将必须安装匹配版本的节点,或者如果您使用的是 nvm,请使用:nvm use <version>
激活匹配版本。
解决我的相同问题的唯一方法是删除所有 node_modules 并重新安装它们,并且在 React 中一切正常。