在laravel中编译资产时出错:
ERROR Failed to compile with 2 errors
error in ./resources/assets/sass/app.scss
Module build failed: Error: Missing binding /media/xxx/workspace/Projects/Laravel-blog/node_modules/node-sass/vendor/linux-ia32-57/binding.node
Node Sass could not find a binding for your current environment: Linux 32-bit with Node.js 8.x
Found bindings for the following environments:
- Linux 32-bit with Node.js 7.x
package.json
{
"private": true,
"scripts": {
"dev": "NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"hot": "NODE_ENV=development webpack-dev-server --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"production": "NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.15.3",
"bootstrap-sass": "^3.3.7",
"cross-env": "^3.2.4",
"jquery": "^3.1.1",
"laravel-mix": "^1.0",
"lodash": "^4.17.4",
"vue": "^2.5.2",
"webpack": "^3.8.1"
},
"dependencies": {
"bootstrap": "^3.3.7"
}
}
我认为问题在于环境绑定,因为错误消息显示了。
另外要提一下,如果我只编译js文件,那么它的成功构建。我尝试npm rebuild node-sass
但没有帮助
我该如何修复错误?
机器:Ubuntu 16.04
npm -v:5.5.1
node -v:v8.6.0
答案 0 :(得分:1)
当您拥有版本8时,绑定正在搜索节点版本7.
尝试以下命令:
npm rebuild node-sass