skip to Main Content

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


  1. The CSS rem() function required 2 parameters: https://developer.mozilla.org/en-US/docs/Web/CSS/rem

    The rem() CSS function returns a remainder left over when the first
    parameter is divided by the second parameter, similar to the
    JavaScript remainder operator (%)

    If you created a custom rem() function, I suggest naming it something else as there could be a conflict.

    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search