Reputation: 12701
I'm running the following command:
ng build --prod --aot --base-href ./
And receiving;
ERROR in Module build failed (from ./node_modules/sass-loader/lib/loader.js):
$clr-popover-box-shadow-color: rgba(clr-getColor(dark), 0.25);
^
Argument `$color` of `rgba($color, $alpha)` must be a color
in /Users/allan/git/dcfrontend/node_modules/@clr/ui/src/utils/_variables.global.scss (line 84, column 32)
I'm on Angular 7 and Clarity 1.04.
Extract from my angular.json
:
"styles": [
"node_modules/@clr/icons/clr-icons.min.css",
"node_modules/@clr/ui/clr-ui.min.css",
"node_modules/prismjs/themes/prism-solarizedlight.css",
"src/styles.css",
"node_modules/lato-font/css/lato-font.min.css"
],
"scripts": [
"node_modules/core-js/client/shim.min.js",
"node_modules/mutationobserver-shim/dist/mutationobserver.min.js",
"node_modules/@webcomponents/custom-elements/custom-elements.min.js",
"node_modules/web-animations-js/web-animations.min.js",
"node_modules/prismjs/prism.js",
"node_modules/prismjs/components/prism-typescript.min.js",
"node_modules/@clr/icons/clr-icons.min.js"
]
Upvotes: 16
Views: 77693
Reputation: 11
In my case, I saw this error when we upgraded from Angular 9.x to 12.x. I had multiple versions of Node 12.2 and 12.14 (*). I kept getting this error till I uninstalled 12.2 and did npm install after.
Upvotes: 0
Reputation: 959
I am running node -v 12.14.1 on MAC OS and got into this issue when tried to fix npm audit (npm audit fix). After this I got issue and same message. I haven't have option to get lower version of node to try some of suggestions on this page so I tried to re-install node-sass but that did not help. However, rebuilt dependencies did help.
I have removed node_modules folder, ran sudo npm install
(newer Mac OS has some permission issues so do sudo) than npm rebuild node-sass
and it resolved my build issue. I hope this helps someone too if other suggestions on this page did not.
Upvotes: 1
Reputation: 21
I don't know if someone needs to see this
npm rebuild node-sass
would not work out of the box for some new versions of node like 15.X.X in my case, the fix for this is to downgrade the node version, in my case I downgraded to version 10.16.3, then I ran the npm rebuild node-sass
command and the error does not show again
Upvotes: 1
Reputation: 95
In my case I wasn't running (ng serve) from the root folder of my project. Moving to the root folder solved the issue for me.
Upvotes: 0
Reputation: 150
Use NVM to downgrade your node version - 99% of these errors are coming from a version clash between node-sass supported node versions and what you are running on your system. It's still a frustrating one!
Upvotes: 3
Reputation: 4934
check for the supported version. As on date I had node 12.x installed on my machine and spent an hour running npm install node-sass
and npm rebuild node-sass
with --force
and --save-dev
hints.
Nothing worked until I uninstalled the node 12.x and installed node 10.x. So if you're hitting the same problem and could not get it to work, try following
Upvotes: 3
Reputation: 2679
npm install node-sass
Worked for me :) Just try this if "npm rebuild node-sass" not worked
Upvotes: 11
Reputation: 3177
I was also getting the same error and i solved it by running the below npm command:
npm rebuild node-sass
Upvotes: 31
Reputation: 12701
So I got my answer by running ng serve
instead of ng build
- this told me which of my own source files actually contained the issue.
I resolved it by replacing the following imports:
@import '../../../../node_modules/@clr/ui/src/utils/helpers.clarity';
@import '../../../../node_modules/@clr/ui/src/color/utils/colors.clarity';
@import '../../../../node_modules/@clr/ui/src/color/utils/contrast-cache.clarity';
@import '../../../../node_modules/@clr/ui/src/color/utils/helpers.clarity';
@import '../../../../node_modules/@clr/ui/src/utils/variables.clarity';
with hardcoded values:
$clr-header-height: 2.5rem;
$clr-near-white: #fafafa;
$clr-dark-gray: #565656;
$clr-light-gray: #eee;
Upvotes: 0