I get he below error while building my project
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: 2 arguments required, but only 1 was passed.
╷
width: rem(300);
^^^^^^^^
Below is my package.json
{
"name": "test",
"version": "3.0.0",
"private": true,
"scripts": {
},
"devDependencies": {
"mini-css-extract-plugin": "^2.4.2",
"node-sass": "^6.0.1",
"postcss": "^8.3.9",
"postcss-loader": "^6.2.0",
"postcss-preset-env": "^6.7.0",
"sass": "^1.3",
"sass-loader": "^12.1.0"
},
"dependencies": {
"grunt-sass": "^3.1.0"
}
}
I am sure rem(300) is a valid syntax. Can you please tell me why the build is throwing this error
2
Answers
The CSS
rem()
function required 2 parameters: https://developer.mozilla.org/en-US/docs/Web/CSS/remIf you created a custom
rem()
function, I suggest naming it something else as there could be a conflict.Ran into the same problem today, I had "sass": "^1.26.5" in my package.json.
sass got updated yesterday to 1.65.1, your build should work with 1.64.2
https://www.npmjs.com/package/sass/v/1.65.1?activeTab=versions
I got that problem due to another dependency I have no control over, so changing sass version was the only option for now. But if you used rem() in your own code, go for Ali Klein’s answer.