Closed cassidoo closed 3 years ago
i have same problems..
Error message:
Module not found: Can't resolve '/Users/n-futagami/Project/hayaben/hayaben-next/node_modules/next/node_modules/@babel/runtime/helpers/esm/extends'
@babel
packages not found in node_modules/next/node_modules
.
but, node_modules/@babel/...
is exists.
What is the solution?
Meanwhile, my error was this:
ModuleNotFoundError: Module not found: Error: Can't resolve '<...>/node_modules/next/node_modules/@babel/runtime/helpers/construct'
I have also seen
ModuleNotFoundError: Module not found: Error: Can't resolve '<...>/node_modules/next/node_modules/@babel/runtime/helpers/esm/defineProperty'
In both of these cases, the nonsensical downgrade/upgrade of @babel/runtime
Cassidy mentioned above is what works for me; that was my suggestion to her on the Next Discord channel earlier today. @nobu222, you should give that a try and see if it clears your issue up.
I have no idea why it works; I end up with the same version of @babel/runtime
I started with, yet I can reproducibly cause this error (by deleting package_lock.json
then running npm i
) and fix it again via those commands, at least within my project. I haven't been able to make a minimal breaking case.
In particular, with a bit more detail, and an extra step just for clarity:
npm i @babel/runtime
(it installs 7.12.5 which was already installed as a nested dependency), build still failsnpm i @babel/runtime@7.12.1
(which is the previous version), build now succeedsnpm i @babel/runtime@latest
(which is 7.12.5), build still succeedsnpm r @babel/runtime
(it's removed from package.json but still installed as it's a nested dependency), build still succeedsMaybe it won't work for you though -- it didn't work for Cassidy.
@tremby Thanks for the feedback! It's working as expected.
i tried your steps. ( i'm using yarn, not npm)
Successed only step2 (using @babel/runtime@7.12.1). i decided to use old version(7.12.1) in my project.
I'm not able to reproduce this, however, I have a feeling it's a bug with npm that's causing this.
Can you try to delete both package-lock.json
and node_modules
and running an install again?
I'm not able to reproduce this, however, I have a feeling it's a bug with npm that's causing this.
Can you try to delete both
package-lock.json
andnode_modules
and running an install again?
@Timer my update line was tiny so you might have missed it, but I fixed it this way:
Update: I downgraded to Next.js v10.0.3, and then back to v10.0.4, and now it is working just fine again!
It's a weird one. I did try the package-lock.json and node_modules thing first, and it didn't work.
Oh interesting, yeah I must've misread that! Our hands are a bit tied when it comes to npm bugs.
However, this PR may prevent this specific instance: https://github.com/vercel/next.js/pull/19538 There's no guarantee a second error wouldn't of popped up. 😞
If you have the original package-lock.json
, it might be worth sending it to the npm support team and ask them to analyze it to fix the bug on upgrade.
I'm having this same exact problem with any Next version since 10.0.5. The only workaround I've found is downgrading Next to version 10.0.4.
I also have the same problem. My workaround is to delete yarn.lock
file, delete node_modules
directory, and reinstall all dependency (yarn / yarn install). Boom, errors are gone.
Same issue, only solution was to downgrade Next to 10.0.4
I had the same problem after cleaning up some unused dependencies. I tried upgrading everything, cleaning the yarn.lock but nothing worked. After enabling webpack5, the error is gone.
See https://nextjs.org/docs/messages/webpack5 for more info.
Has a similar issue happen on my jenkins build job, it built fine for me locally. (next@10.1.3)
ModuleNotFoundError: Module not found: Error: Can't resolve '<BUILD-DIRECTORY>/node_modules/next/node_modules/@babel/runtime/helpers/construct' in '<BUILD-DIRECTORY>/node_modules/next/dist/client'
enabling webpack5 on my next.config.js solved it for me. hats off to @christian-fuss
future: {
webpack5: true,
},
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
Describe the bug
I have a basic Next.js v10.0.4 application, and when I add an
_app.js
file, I get this error:When I downgrade to v10.0.3, the error goes away.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
_app.js
file:export default Application
error - ./pages/_app.js Module not found: Can't resolve '@babel/runtime/helpers/esm/defineProperty' in '/.../pages' Error: Cannot find module '/.../.next/build-manifest.json' Require stack:
Expected behavior
I expect the application to run without any user-facing changes.
System information
Additional context
Specifically I was trying to update this repo and a couple others, but I haven't pushed any yet because of this, and all of them have had this issue. I deleted
node_modules
before updating the Next.js version.I tried doing the following to see if that would change anything, but no dice:
Update: I downgraded to Next.js v10.0.3, and then back to v10.0.4, and now it is working just fine again!