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' #57

Closed
T00rk opened this issue Jun 11, 2021 · 12 comments · Fixed by #62 or #63
Closed

Module not found: Error: Can't resolve 'fs' #57

T00rk opened this issue Jun 11, 2021 · 12 comments · Fixed by #62 or #63
Assignees
Labels
bug Something isn't working builds

Comments

@T00rk
Copy link

T00rk commented Jun 11, 2021

I've updated my docusaurus project to 2.0.0-beta.0 and redocusaurus is not working anymore due to this error

Module not found: Error: Can't resolve 'fs'

Module not found: Error: Can't resolve 'fs' in '/home/romain/Projets/help/node_modules/redoc/bundles'
Module not found: Error: Can't resolve 'process/browser' in '/home/romain/Projets/help/node_modules/yaml/browser/dist'
Did you mean 'browser.js'?
BREAKING CHANGE: The request 'process/browser' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '*.mjs' file or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
@rohit-gohri
Copy link
Owner

Can you also update redocusaurus to v0.4.2? In the beta webpack was upgraded to v5 that caused build issues.

Related to #25

@T00rk
Copy link
Author

T00rk commented Jun 12, 2021

The last available version on npm is 0.4.1

@MaxandreJ
Copy link

Hi, thanks for developing this package! Is there a way to make it work? I'm a novice with npm and I'm not sure how to install a specific version of your package from github.

I tried
npm install https://github.com/rohit-gohri/redocusaurus#4d415d68d3f07cbbd9757f39ba68f915586379e4 --save redocusaurus

(4d415d68d3f07cbbd9757f39ba68f915586379e4 is your v0.4.2 commit)

but I still have the same issue

@rohit-gohri
Copy link
Owner

Yeah, sorry. 0.4.1 is the latest. 0.4.2 was for the internal package. I'm not sure what the problem is here because I have it running with 2.0.0-beta in the examples: https://github.com/rohit-gohri/redocusaurus/tree/main/example

Could one of you share a minimal repo where this is happening?

@T00rk
Copy link
Author

T00rk commented Jun 14, 2021 via email

@patrick-simonson
Copy link

+1 - Cloning your repo and doing an npm install + npm run start in the example folder brings up the issue for me.

@drichards-87
Copy link

I was encountering the same issue (see my comment in #14). I was able to workaround it by downgrading the installed version of Redoc to v2.0.0-rc.53.

@rohit-gohri
Copy link
Owner

I think I would have to pin redoc dependency to a specific version instead of using ^

@rohit-gohri rohit-gohri added bug Something isn't working dependencies Pull requests that update a dependency file labels Jun 15, 2021
@rohit-gohri rohit-gohri self-assigned this Jun 15, 2021
@bash83
Copy link

bash83 commented Jun 15, 2021

Same issue using GitHub Actions to compile and publish the docs to GitHub Pages:

Module not found: Error: Can't resolve 'fs' in '/home/runner/work/docs/docs/node_modules/redoc/bundles'

Note: this is not happening on local development machine with (docusaurus build).

@sibelius
Copy link

create a sitePlugin.js file, so you can customize docusuarus webpack

module.exports = function (context, options) {
  return {
    name: 'custom-docusaurus-plugin',
    // eslint-disable-next-line
    configureWebpack(config, isServer, utils) {
      return {
        resolve: {
          alias: {
            path: require.resolve('path-browserify'),
          },
          fallback: {
            fs: false,
            http: require.resolve('stream-http'),
            https: require.resolve('https-browserify'),
            os: require.resolve('os-browserify/browser'),
          },
        },        
      };
    },
  };
};

import on docusuarus.config.js

module.exports = {
plugins: [require.resolve('./sitePlugin')],
}

@rohit-gohri
Copy link
Owner

@rohit-gohri rohit-gohri mentioned this issue Jun 26, 2021
@rohit-gohri rohit-gohri added builds and removed dependencies Pull requests that update a dependency file labels Jun 26, 2021
@rohit-gohri
Copy link
Owner

Should be fixed in 0.4.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working builds
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants