-
Notifications
You must be signed in to change notification settings - Fork 26.7k
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
Cannot find module 'next/babel' with Yarn 2 and Next.js 10.0.2 #19334
Comments
Latest version of next.js doesn't work under pnp. Look here vercel/next.js#19334 Fixed by downgrading next. Also added pixi.js as an alias to pixi.js-legacy As pixi-viewport was complaining under pnp
One workaround is to turn off yarn 2's PNP:
nodeLinker: "node-modules" Credit to @SagnikPradhan in his PR above. |
Is there anything I can do to help this get fixed as soon as possible? |
@jensmeindertsma write a PR. seeing this on |
This is true, but I need one for ESLint with |
idk why no one has mentioned it but you can change you'll need a babel.config.js not a .babelc though. heres an example
then however this should still be fixed in the actual codebase. i wonder what is causing it since |
@davecaruso great hint, also if you're working in a monorepo context, you could have |
Fixed in #20586 (v10.0.5-canary.4) |
@merceyz thank you! |
**What's the problem this PR addresses?** - ~~#18768 started to ncc babel and thus it's version of resolve which breaks PnP support~~ Babel replaced `resolve` with the builtin `require.resolve` and a polyfill for older node versions in babel/babel#12439 which was upgraded in #20586 - `next` unnecessarily bundles the `resolve` package when `require.resolve` is builtin and can do the same job **How did you fix it?** - ~~Avoid running `resolve` through ncc~~ Added a test for #19334 (closes #19334) - Replace `resolve` with `require.resolve`
This worked perfectly thank you very much |
I was getting this error because I was trying to edit |
Because you weren't opening the project folder directly. It appears to be related to how ESLint needs to be configured for workspaces. Just create a folder name
And the warning will disappear! Hope it works for you 😄 Source: https://stackoverflow.com/questions/68163385/parsing-error-cannot-find-module-next-babel |
@igdev116 thank you very much for this! 👍 |
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
When using Yarn 2.3.3 with Next.js 10.0.2 and custom
.babelrc
file that extends default presetnext/babel
(according to https://nextjs.org/docs/advanced-features/customizing-babel-config),yarn run dev
results inCannot find module 'next/babel'
error.Prior to 10.0.2 this used to work without error.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
yarn create next-app my-app
cd my-app
yarn set version berry && yarn set version latest && yarn install
.babelrc
file with the following contents:yarn run dev
Expected behavior
no errors and the dev environment starts fine.
the following work as expected:
Screenshots
System information
Additional context
N/A
The text was updated successfully, but these errors were encountered: