🐙

laravel npm devができないときの対処法

2020/10/05に公開約1,000字

エラー内容

Laravel6で認証機能をつけていたところ、npm devでエラーが発生

↓↓エラーメッセージ↓↓
ERROR in ./resources/sass/app.scss (./node_modules/css-loader??ref--5-2!./node_modules/postcss-loader/src??postcss0!./node_modules/resolve-url-loader??ref--5-4!./node_modules/sass-loader/dist/cjs.js??ref--5-5!./resources/sass/app.scss)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
ValidationError: Invalid options object. Sass Loader has been initialized using an options object that does not match the API schema.

  • options has an unknown property 'outputStyle'. These properties are valid:
    object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? }
    at validate (/Applications/MAMP/htdocs/clonet/node_modules/schema-utils/dist/validate.js:98:11)
    at Object.loader (/Applications/MAMP/htdocs/clonet/node_modules/sass-loader/dist/index.js:36:28)
    @ ./resources/sass/app.scss 2:14-253

原因

npmのsass-loaderのバージョンがよくない

対処法

npm devでエラーが出たあとに
$npm uninstall --save-dev sass-loader
$npm install --save-dev sass-loader@7.1.0
で解決

参考サイト

https://nebikatsu.com/5428.html/

Discussion

ログインするとコメントできます