webpack构建时缺少绑定/myproject/node_modules/node-sass/vendor/linux-x64-57/binding.node
Posted
技术标签:
【中文标题】webpack构建时缺少绑定/myproject/node_modules/node-sass/vendor/linux-x64-57/binding.node【英文标题】:Missing binding /myproject/node_modules/node-sass/vendor/linux-x64-57/binding.node while webpack build 【发布时间】:2018-05-01 11:29:03 【问题描述】:我在构建项目时遇到以下错误。实际上错误说“缺少绑定/myproject/node_modules/node-sass/vendor/linux-x64-57/binding.node”,但我有“缺少绑定/myproject/node_modules/node-sass/vendor/linux-x64-48 /binding.node”。我不知道为什么它没有引用“linux-x64-48”?
错误提示运行npm rebuild node-sass --force
,我这样做了,但没有运气。请帮我解决这个问题。
节点版本:v8.9.1
npm:5.5.1
注意:我什至尝试删除整个 node_modules 并重新安装(npm install
)它。但仍然出现同样的错误。
ERROR in ./node_modules/css-loader!./node_modules/vue-loader/lib/style-compiler?"vue":true,"id":"data-v-6ef6ca5e","scoped":true,"hasInlineConfig":false!./node_modules/sass-loader/lib/loader.js!./node_modules/vue-loader/lib/selector.js?type=styles&index=0&bustCache!./src/components/UserProfile.vue
Module build failed: Error: Missing binding /myproject/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 6.x
This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass --force` to build the binding for your current environment.
at module.exports (/myproject/node_modules/node-sass/lib/binding.js:15:13)
at Object.<anonymous> (/myproject/node_modules/node-sass/lib/index.js:14:35)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/myproject/node_modules/sass-loader/lib/loader.js:3:14)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Module.require (module.js:579:17)
@ ./node_modules/vue-style-loader!./node_modules/css-loader!./node_modules/vue-loader/lib/style-compiler?"vue":true,"id":"data-v-6ef6ca5e","scoped":true,"hasInlineConfig":false!./node_modules/sass-loader/lib/loader.js!./node_modules/vue-loader/lib/selector.js?type=styles&index=0&bustCache!./src/components/MyProfile.vue 4:14-346 13:3-17:5 14:22-354
@ ./src/components/UserProfile.vue
@ ./src/router.js
@ ./src/main.js
@ multi ./build/dev-client ./src/main.js
ERROR in ./node_modules/css-loader!./node_modules/sass-loader/lib/loader.js!./src/assets/scss/main.scss
Module build failed: Error: Missing binding /myproject/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 6.x
【问题讨论】:
【参考方案1】:这可能是由于您的机器上的节点版本不匹配而您的应用程序正在等待。 就我而言,在构建 docker 映像时,基本机器上的版本和 docker 映像上的版本不同。
【讨论】:
【参考方案2】:这通常发生在环境快速变化时(将 sass 文件复制到一个位置到另一个位置) 这将帮助您解决此问题。
npm install
npm rebuild node-sass --force
【讨论】:
【参考方案3】:此问题已由npm rebuild node-sass
、github issue 解决
【讨论】:
以上是关于webpack构建时缺少绑定/myproject/node_modules/node-sass/vendor/linux-x64-57/binding.node的主要内容,如果未能解决你的问题,请参考以下文章
错误缺少绑定 app/nodes_modules/node-sass
错误NETSDK1007找不到“E:ProjectMyProjectMyProject.CommonMyProject.Utility.csproj”的项目信息。这可以指示缺少一个项目引用。M