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

Created on 15 May 2016  ·  22Comments  ·  Source: vuejs-templates/webpack

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

Most helpful comment

npm install sass-loader --save-dev

All 22 comments

npm install sass-loader --save-dev

You also need:

npm install --save-dev node-sass

yeah, thank you
i got another error:

<style lang='sass'>

html, body {
    width: 100%;
    height: 100%;
}

and i run dev, i got this error:
Invalid CSS after "html, body {": expected "}", was "{"
i don't understand why

You are writing SCSS, not SASS.

thanks for your help, can you tell me more, for example, is this right?

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

It should be:

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

https://github.com/vuejs/vue-loader
the examples here use the same syntax
2016-05-15 8 55 56

yeah, i understand now, thank you very much

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>

try this

npm i sass-loader node-sass -D

I get [email protected] 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.

when i install sass-loader, i get error
npm WARN prefer global [email protected] should be installed with -g

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

You also need:

npm install --save-dev node-sass

Absolutely right

Screen Shot 2019-04-28 at 11 39 16

I installed sass-loader node-sass webpack GLOBALLY.
Yet, I'm still seeing this error.
Is installing globally this 3 package not recommended?

npm i sass-loader node-sass sass-resources-loader -D

After install two packages , need to restart dev server

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

As i was using Nuxt.js the thing that worked for me was:

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

My problem was that I had two JS subprojects (backend and frontend), and I've been installing node-sass and sass-loader in backend instead of frontend ^___^

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

Al parecer el la versión
npm install --save-dev [email protected]

@renepastor gracias por esa sugerencia! yo tuve que instalar [email protected]. parece que la version 11 no es compatible o algo por el estilo.

Was this page helpful?
0 / 5 - 0 ratings