Error installing bcrypt - Error [ERR_REQUIRE_ESM]: require() of ES Module

134 Views Asked by At

I am trying to install bcrypt to my NextJs project but I am getting an error. I am using "yarn add bcrypt."

Error [ERR_REQUIRE_ESM]: require() of ES Module ...\Portfolio\fo
od-ordering\node_modules\strip-ansi\index.js from ...\
food-ordering\node_modules\string-width\index.js not supported.
Instead change the require of ...\food-ordering\node_m
odules\strip-ansi\index.js in ...\food-ordering\node_m
odules\string-width\index.js to a dynamic import() which is available in all Common
JS modules.
    at Object.<anonymous> ...\food-ordering\node_modules\string-width\index.js:2:19) {
    at Object.<anonymous> ...\food-ordering\node_modules\string-width\index.js:2:19) {
  code: 'ERR_REQUIRE_ESM'
}

Node.js v20.11.0
0

There are 0 best solutions below