RickyMed
RickyMed

Reputation: 11

How to fix this angular error "Module build failed (from ./node_modules/sass-loader/lib/loader.js):"?

Just built a brand new Angular App with SASS but when trying to write sass I get the following error

Module build failed (from ./node_modules/sass-loader/lib/loader.js).

This is what I'm running on - Angular-Cli: 8.2.0, Node: 10.16.2, NPM: 6.9.0

I've tried adding a webpack config file in the attempt to try out a solution from a similar issue but instead in a react app.

module: {
    rules: [
        {
            test: /.(ts|tsx)?$/,
            use: [
                MiniCssExtractPlugin.loader,
                    {
                        loader: "css-loader",
                        options: {
                            minimize: true,
                            sourceMap: true
                        }
                    },
                    {
                        loader: "sass-loader"
                    }
            ],
            loader: 'ts-loader',
            enter code hereinclude: [path.resolve(__dirname, 'src')],
            exclude: [/node_modules/]
        }
    ]
}

I would like to just be able to write SASS within the angular framework.

Upvotes: 1

Views: 2525

Answers (2)

RickyMed
RickyMed

Reputation: 11

I was simply trying to write scss when having the .sass ext. Easy fix knowing now what I was doing wrong.

Upvotes: 0

Sonia
Sonia

Reputation: 1919

Trying using the below commands

sudo npm rebuild node-sass

sudo npm install --save-dev  --unsafe-perm node-sass

Upvotes: 3

Related Questions