Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module not found: Error: Can't resolve 'fs' in xxx #79

Open
dwebfan opened this issue Mar 11, 2022 · 4 comments
Open

Module not found: Error: Can't resolve 'fs' in xxx #79

dwebfan opened this issue Mar 11, 2022 · 4 comments

Comments

@dwebfan
Copy link
Contributor

dwebfan commented Mar 11, 2022

Got this failure in recent upgrade. I've tried some solutions, such as webpack-contrib/css-loader#447, but unlucky so far. Can you help?

Compiled with problems:X

ERROR in ./node_modules/argon2-browser/dist/argon2.js 49:26-39

Module not found: Error: Can't resolve 'fs' in '/frontend/node_modules/argon2-browser/dist'

@Cajuteq
Copy link

Cajuteq commented Jun 29, 2022

Hi, I had the same problem and used browser compatible deps as placeholders for the fs, path, and crypto packages. Hopes this can help you.

  "dependencies": {
    ...  
    "crypto": "npm:crypto-browserify",
    "crypto-browserify": "^3.12.0",
    "fs": "npm:fs-browsers",
    "fs-browsers": "^1.1.6",
    "path": "npm:path-browserify",
    "path-browserify": "^1.0.1",
    ...
  }

@dangtony98
Copy link

dangtony98 commented Jan 29, 2023

Wonder if there's a better way around this ... I'd prefer to stay away from introducing new dependencies to solve this issue.

@antelle would you have any solutions for this? - I'm running a Next.js application and need to use argon2-browser.

Edit:

The example provided in this repo worked perfectly for nextjs

@glihm
Copy link

glihm commented Jan 30, 2023

Did you try to disable those in the package.json file?

"browser": {
    "fs": false
},

@dangtony98 the example you linked is doing exactly this in the configuration file next.config.js:

if (!isServer) {
  config.resolve.fallback.fs = false;
}

@valerius21
Copy link

valerius21 commented Jan 7, 2024

Could not find any of the solutions above to get them to work on NextJS 14. I'm using it with skiff-crypto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants