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: Can't resolve 'fs in node_modules/destroy #9768
Comments
Sounds like you're doing something wrong in your app which ends up importing all of next.js and then tries to bundle it. Please always provide a full reproduction when creating issues as it's really hard to tell now. |
Hi @timneutkens sorry for the generic description, I've tried to create a slightly stripped down repo and posted it here https://github.com/iteratelabs/next-not-working for you to see publicly. As well as updated the reproduction steps We haven't made any changes where we would be importing all of next.js and creating this error |
Cool, thanks! Will have a look later. |
@timneutkens facing the same issue. Seems like somethings broke in Next.JS dependency tool chain. Encountered this after fresh |
It's probably due to zivl/sentry-testkit#43 |
can confirm that our issue was related to the sentry package problem, one of our developers figured this out yesterday. Should the next example with sentry https://github.com/zeit/next.js/tree/canary/examples/with-sentry be updated perhaps? We originally followed this to implement sentry but it seems going forward with newer versions of sentry this will no longer work as is |
@jrusso1020 IMO the next example should be updated with the alternative solution I suggested in the other ticket, copy pasting here:
This doesn't use the testkit at all. |
@ohana54 I agree, I have changed my code to the code you suggested and my next js app is working in development mode again. I can open up a PR with the changes |
With an update to sentry-testkit to depend on native node modules this example no longer works in the browser. Sentry-testkit is made for a node server not to work in the browser. However, with this change we no longer require sentry-testkit in our setup for sentry. Before this change with the update of sentry-testkit to 3.1 we were encountering errors when trying to run the next.js local development server because it was trying to load sentry-testkit in the browser. Thank you to @ohana54 for his example found here zivl/sentry-testkit#43 this will now close this issue vercel#9768 as well.
With an update to sentry-testkit to depend on native node modules this example no longer works in the browser. Sentry-testkit is made for a node server not to work in the browser. However, with this change we no longer require sentry-testkit in our setup for sentry. Before this change with the update of sentry-testkit to 3.1 we were encountering errors when trying to run the next.js local development server because it was trying to load sentry-testkit in the browser. Thank you to @ohana54 for his example found here zivl/sentry-testkit#43 this will now close this issue #9768 as well.
This comment has been minimized.
This comment has been minimized.
I have this problem too
but @jrusso1020 my console doesn't show the warning that you say appears in yours: It appears only when I have the dynamic routes " [id].js " and show me this error:
this is a nightmare, there is a real and official solution for this problem?? |
Same issue with the author, and we've used |
I got this problem when I was converting function to class element vc code accidentally auto imported |
This worked for me on the latest version of Next JS. I had to move serverless-mysql db.js file from pages directory and it worked. I could not find any solution until I saw your answer, thank you for sharing this. |
i was getting the same error, but it was due to my mistake, since i am using axios for network request, but a some point in my app i typed |
Just got the same error when I was importing an object in a front-end page but the object was defined in an API route which includes server-side imports. Solution was to export the object from its own file so the (unrelated) imports wouldn't get in the way. Might be a common mistake which is why I'm dropping this here as one possible solution. The error message could definitely be more helpful about which import exactly is causing the trouble 😅 Here's what it looks like with
|
it was my problem |
Perhaps it's not the author issue, but could be helpful for someone else. I had a similar issue with the module "next-page-tester" Solution: move test files out of |
I also mistakenly imported this: |
I had the same issue using 'next-auth'. I was using some functions like this: import { providers, signIn, csrfToken, getSession } from 'next-auth'; while the actual path to the import wasn't 'next-auth' but 'next-auth/client'. So, in my case, I wasn't importing the function from the correct path, but still the error messages prompted didn't help me at all to figure out what was going on and the replies in this thread did help me to have a cue of what possibly was going on. |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
After upgrading to Next 9.1.6 I am having a problem running my next js server locally. I get
When running
npm run dev
, however this change seems to be working fine in production it just happens locally when running the hot reloading serverDescribe the bug
^^ Look at above description
I think it might possibly have to do with this change. We are no longer requiring
fs
in the hot reloader fd95d6c#diff-6161346d2c5f4b7abc87059d8768c44bL1To Reproduce
Edit:
Clone this repo https://github.com/iteratelabs/next-not-working
use node version 10.15.3
npm install
run the command
npm run dev
and you should get a module not found error.Expected behavior
Expected behavior is for the development server to still run the web application after upgrading.
Screenshots
System information
Additional context
EDIT: I downgraded to 9.1.5 and still get the same error however. Was not getting this error previously though until today
I took a look at this issue #7755 and added
to my webpack config but then I got the following error
So now I have
Which allows me to build the webapp and run it in the development server but I get this warning
The text was updated successfully, but these errors were encountered: