Module not found: Can't resolve 'fs' in Jbrowse 1.3.3 with Next.js
See original GitHub issueDescribe the bug
Hi, I have tried to upgrade to Jbrowse 1.3.3, but since this update, I can’t build my Next.js project, as I got the following error:
In dev mode:
./node_modules/@jbrowse/core/util/io/LocalFile.js:42:0
Module not found: Can't resolve 'fs'
Import trace for requested module:
./node_modules/@jbrowse/core/util/io/index.js
./node_modules/@jbrowse/plugin-bed/dist/plugin-bed.esm.js
./node_modules/@jbrowse/react-linear-genome-view/dist/react-linear-genome-view.cjs.development.js
./node_modules/@jbrowse/react-linear-genome-view/dist/index.js
./pages/index.js
And this one when trying to build the production version:
Failed to compile.
ModuleNotFoundError: Module not found: Error: Can't resolve 'fs' in '/export/home1/users/mpb/zweig/Desktop/projects/nextjs-jbrowse/node_modules/@jbrowse/core/util/io'
> Build error occurred
Error: > Build failed because of webpack errors
at /export/home1/users/mpb/zweig/Desktop/projects/nextjs-jbrowse/node_modules/next/dist/build/index.js:390:19
at async Span.traceAsyncFn (/export/home1/users/mpb/zweig/Desktop/projects/nextjs-jbrowse/node_modules/next/dist/telemetry/trace/trace.js:60:20)
To Reproduce
I have created a new Next.js project with just Jbrowse, so you can easily reproduce the error. It is available here.
Step to clone and launch it:
git clone
cd nextjs-jbrowse
# Dev environnement
yarn dev
# Production
yarn build && yarn start
Version: Next.js: 11.1.0 Jbrowse: 1.3.3 React & React-Dom: 17.0.2
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Module not found: Can't resolve 'fs' in Next.js application
The Module not found: can't resolve 'xyz' error happens when you try to use server only code outside of these methods. Error example...
Read more >Module not found: Can't resolve 'fs' · Issue #7755 · vercel/next.js
I'm using the popular find-up npm package, which has locate-path as a dependency. locate-path requires fs within it's code. When I attempt to ......
Read more >can't resolve 'fs' import trace for requested module: - You.com
I have created a new Next.js project with just Jbrowse, so you can easily reproduce the error. It is available here. Step to...
Read more >How To Solve Module Not Found Can't Resolve 'fs' in Next.js
js project, I encountered the following error: Module not found: Can't resolve 'fs'. While this is a seemingly clear error, the quest for...
Read more >Module not found | Can't resolve 'fs' in Next js application
Join this channel to get access to perks:https://www.youtube.com/channel/UCoSpmr2KNOxjwE_B9ynUmig/joinMy GearCamera ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@cmdcolin Good to know, I just wanted to be sure it didn’t slip under your radar. @garrettjstevens Thanks again for your help, I close the issue.
@Akusem those warnings can be ignored. The code should run fine despite them. We can do some work to try to clean up some warnings but it should be fine.
We also are perfectly fine with react 17, it is what we use currently now
Just for more info e.g. Some of the warnings are like "warning “@jbrowse/react-linear-genome-view > mobx-react > mobx-react-lite@2.2.2” has incorrect peer dependency “react@^16.8.0"” because the code thinks it wants react 16.8 but generally they just didn’t update to say that they also allow react 17, and we dont have control over that necessarily unless they update and we update along with it. until then, it’s just a little diagnostic warning.