Issues with argon2 - node-pre-gyp - can't resolve 'fs'

195 Views Asked by At

This seems to be a common error online using the argon2 package and versions of node. The error:

../../node_modules/@mapbox/node-pre-gyp/lib/clean.js:8:0
Module not found: Can't resolve 'fs'

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
../../node_modules/@mapbox/node-pre-gyp/lib/ sync ^\.\/.*$
../../node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js
../../node_modules/argon2/argon2.js
../../packages/db/src/service/auth/password-reset.ts
../../packages/db/src/service/auth/index.ts
./middleware.ts

My specs:

  • ComputerOS: MacOS 2.3 GHz Dual-Core Intel Core i5
  • Argon2 Version: "argon2": "^0.30.3",
  • Node Version: node v18.16.0
  • Yarn Version: yarn 1.22.18

What version of node should I downgrade to if that is the only solution? Just confused because I'm currently on Long-term Stable version of node but this is still an issue...

0

There are 0 best solutions below