Alireza
Alireza

Reputation: 104740

Webpack sass loading Error with style.scss in Angular 4

I'm trying to do add postcss-loader to Angular 4 with platform-server rendering, I keep getting the error as below, basically what I'm trying to do is adding style.scss as global scss to my webpack process, similar the way it's working in cli...

 ERROR in ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader/lib?{}!./~/sass-loader/lib/loader.js!./src/styles.scss
        Module build failed: Error: No PostCSS Config found in: /Users/alireza.dezfoolian/Desktop/Angular 4/web-app/src
            at /Users/alireza.dezfoolian/Desktop/Angular 4/web-app/node_modules/postcss-load-config/index.js:51:26

Upvotes: -1

Views: 335

Answers (3)

solanki...
solanki...

Reputation: 5098

I also faced this problem and is because of the node-sass package. So, it is necessary to rebuild your node-sass package.

Run the cmd: npm rebuild node-sass to make sure it is ready.

See the below snippet of my ubuntu terminal:

asus@asus:~/Documents/demo$ npm rebuild node-sass                            

> [email protected] install /home/asus/Documents/demo/node_modules/node-sass   
> node scripts/install.js                                                    

Cached binary found at /home/asus/.npm/node-sass/4.5.3/linux-x64-48_binding.n
ode                                                                          

> [email protected] postinstall /home/asus/Documents/demo/node_modules/node-sas
s                                                                            
> node scripts/build.js                                                      

Binary found at /home/asus/Documents/demo/node_modules/node-sass/vendor/linux
-x64-48/binding.node                                                         
Testing binary                                                               
Binary is fine                                                               
[email protected] /home/asus/Documents/demo/node_modules/node-sass 

And my issue get resolved out!!!

Upvotes: 0

Robin Dijkhof
Robin Dijkhof

Reputation: 19288

I think you need to add node-sass to your project. To install node-sass you need node-gyp globally installed. Check this installation part for node-gyp.

Upvotes: 0

Dmitrij Kuba
Dmitrij Kuba

Reputation: 1038

Just use the sass-loader.

{
    test: /\.scss$/,
    use: ['to-string-loader', 'css-loader', 'sass-loader']
}

Upvotes: 0

Related Questions