【问题标题】:Node Sass missing binding for multiple node versionsNode Sass 缺少多个节点版本的绑定
【发布时间】:2017-09-02 11:33:05
【问题描述】:

我正在使用 nvm 在节点版本之间切换。

我的 package.json:

"scripts": { "dev": "rm -rf public/assets/*.hot-update.js && NODE_ENV=development webpack --env=dev --progress --profile --colors", "prod": "NODE_ENV=production webpack --env=prod --progress --profile --colors" }, "author": "", "license": "ISC", "devDependencies": { "babel-core": "^6.18.2", "babel-loader": "^6.2.10", "babel-preset-es2015": "^6.18.0", "babel-preset-stage-0": "^6.16.0", "babel-preset-stage-2": "^6.18.0", "compression-webpack-plugin": "^0.3.2", "css-loader": "^0.26.2", "extract-text-webpack-plugin": "^2.0.0", "file-loader": "v0.10.0", "imports-loader": "^0.7.0", "node-sass": "^4.1.1", "postcss-cssnext": "^2.9.0", "sass-loader": "^4.1.1", "script-loader": "^0.7.0", "style-loader": "^0.13.1", "uglifyjs-webpack-plugin": "^0.1.2", "vue": "^2.0.3", "vue-lazyload": "0.7.5", "vue-loader": "^10.2.1", "vue-resource": "^1.2.0", "vue-style-loader": "^1.0.0", "vue-template-compiler": "^2.1.8", "vuex": "^2.0.0", "webpack": "2.2.0", "webpack-manifest-plugin": "^1.1.0", "webpack-md5-hash": "^0.0.5", "webpack-merge": "^2.6.1", "whatwg-fetch": "^2.0.2" }

当我使用 Node v6.2.0 并运行 npm run dev 时,我收到以下错误:

ERROR in ./~/css-loader?{"minimize":true}!./~/vue-loader/lib/style-rewriter.js?id=data-v-be2abeee!./~/sass-loader!./~/vue-loader/lib/selector.js?type=styles&index=0!./~/@zoomcarindia/web-zap-revenue-calculator/src/components/graph/graph.vue
    Module build failed: Error: Missing binding /Users/nihar/Documents/zoomcar/web/node_modules/node-sass/vendor/darwin-x64-48/binding.node
    Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 6.x

Found bindings for the following environments:
  - OS X 64-bit with Node.js 7.x

当我使用 Node v7.8.0 时,出现以下错误:

ERROR in ./checklist/~/css-loader?{"minimize":true}!./~/vue-loader/lib/style-rewriter.js?id=data-v-a5234466!./checklist/~/sass-loader!./~/vue-loader/lib/selector.js?type=styles&index=0!./checklist/src/components/Upload.vue
    Module build failed: Error: Missing binding /Users/nihar/Documents/zoomcar/web/checklist/node_modules/node-sass/vendor/darwin-x64-51/binding.node
    Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 7.x

    Found bindings for the following environments:
      - Unknown environment (.DS_Store)
      - OS X 64-bit with Node.js 6.x

无论我使用哪个节点版本,它都说缺少相应的绑定。

我已经多次尝试npm rebuild node-sassrm -rf node_modules

甚至按照here 的建议尝试了npm install --save-dev gulp-sass@2

最初我使用brew 安装了节点。那是 v6.2.0。我按照here 的建议完全删除了system 节点,然后使用nvm 安装了相同的节点。

但问题仍然存在。请让我知道我在这里缺少什么。

【问题讨论】:

  • 你试过npm rebuild node-sass --force吗?
  • 刚试过,没用。
  • 我可以重现该问题,但这为我解决了问题。

标签: node.js npm node-sass


【解决方案1】:

经过数小时的构建系统斗争,我放弃了,与上面的 Matt 类似,我刚刚从https://github.com/sass/node-sass/releases 获取了二进制文件

(Matt 的链接没有上到节点 9)

我创建了运行 webapp(在我的例子中为 Webstorm)说它正在寻找丢失的二进制文件的目录,下载了二进制文件,在我的例子中将 darwin-x64-59_binding.node 重命名为 binding.node 并尝试再次运行 - - 然后它工作了。

【讨论】:

    【解决方案2】:

    npm rebuild node-sass 适用于 VS 2017,但不适用于 VS Code。我必须先运行npm cache clean,然后它才能在 VS Code 中运行。我没有尝试npm rebuild node-sass --force,因为我在找到这个页面之前解决了它,所以我不知道那会不会有同样的效果。

    【讨论】:

      【解决方案3】:

      所以我在 node-sass 上遇到了类似的问题,最后我从 github here 获取了我需要的二进制文件。

      对我来说,我需要 win32-ia32-48,所以我创建了该文件夹并从上面的链接复制到 binding.node 文件中(在重命名它以删除 win32-ia32-48 前缀之后)。

      【讨论】:

        【解决方案4】:

        安装/重建解决方案都没有为我解决问题(使用 gulp)。

        这是我的解决方法:

        1) 从repository 下载缺少的绑定文件。

        2) 重命名文件binding.node

        3) 创建目录/node-modules/vendor/darwin-x64-51/

        4) 将binding.node 文件添加到/node-modules/vendor/darwin-x64-51/

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2020-07-08
          • 2021-10-30
          • 2019-09-18
          • 1970-01-01
          • 2015-07-15
          • 2018-05-01
          • 1970-01-01
          • 2017-07-19
          相关资源
          最近更新 更多