webpack: Module not found: Error: Cannot resolve module 'sass-loader'

i just add <style lang='sass'> into .vue file and then

ERROR in ./src/App.vue Module not found: Error: Cannot resolve module ‘sass-loader’

i did’t change anything else

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 10
  • Comments: 24 (1 by maintainers)

Most upvoted comments

npm install sass-loader --save-dev

You also need:

npm install --save-dev node-sass

I had the same issue with WebPack straight off the bat, here’s the full solution:

npm install node-sass sass-loader --save-dev

Then you MUST stop and rerun your npm task 😃

<style lang="scss">
// didn't seem to matter if lang was scss or sass
</style>

It should be:

<style lang='scss'>
$blue: #1875e7; 
div {
    color: $blue;
}
</style>

try this

npm i sass-loader node-sass -D

You are writing SCSS, not SASS.

I get sass-loader@6.0.6 requires a peer of webpack@^2.0.0 || >= 3.0.0-rc.0 || ^3.0.0 but none was installed when I run npm install sass-loader --save-dev.

After install two packages , need to restart dev server

npm install node-sass sass-loader --save-dev
npm run serve

Al parecer el la versión npm install --save-dev sass-loader@7.1.0

You also need:

npm install --save-dev node-sass

Absolutely right

Screen Shot 2019-04-28 at 11 39 16

when i install sass-loader, i get error npm WARN prefer global node-gyp@3.6.2 should be installed with -g

@renepastor gracias por esa sugerencia! yo tuve que instalar sass-loader@8.0.2. parece que la version 11 no es compatible o algo por el estilo.

If you work with yarn command should be yarn add sass-loader node-sass --dev

Hi, i am try with: $ npm install sass-loader node-sass style-loader --save-dev