-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Build fails after eject: Cannot find module '@babel/plugin-transform-react-jsx' #6099
Comments
I think this is expected. You need to re-run |
@Timer No, re-run |
I am facing the same issue as well. |
Fresh install this morning, seeing the same behaviour outlined above. |
For me that workaround at SO helped. https://stackoverflow.com/questions/53327625/cannot-find-module-babel-plugin-transform-react-jsx-source-when-running-react Nevertheless a real fix would be nice :-) |
@Timer this looks similar to the issue we're seeing that is causing our Travis builds to fail. https://travis-ci.org/facebook/create-react-app/builds/475444651 |
See this CRA does not include this dependency when ejecting. A proper fix in CRA will be better of course. |
I Fixed this ejecting issue by adding @babel/plugin-transform-react-jsx. thx :) |
once yarn eject has been operated, |
I've just stumbled upon this too. My ejected setup missed two dependencies. Calling the below helped:
|
We sometimes see this error in CI and sometimes we don't. I've also tried unsuccessfully to reproduce it locally with a freshly created project. |
I'm having the same issue. @LinkChenzy suggestion worked for me. |
see facebook#6099 for details
@lixiaoyan Yep, |
Me and @abel1105 did some debugging work over in #6679, but I want to move the conversation here. I don't have a solution, but I can consistently reproduce this. Roughly here's what's up: node_modules after
node_modules after - @babel/plugin-transform-react-jsx-self/
@babel/preset-react/
+ @babel/preset-react/node_modules/@babel/plugin-transform-react-jsx-self/
babel-preset-react-app/
babel-preset-react-app/node_modules/@babel/preset-react/ node_modules after @babel/preset-react/
@babel/preset-react/node_modules/@babel/plugin-transform-react-jsx-self/
babel-preset-react-app/
- babel-preset-react-app/node_modules/@babel/preset-react/ |
Good work investigating this. So is this a bug in yarn or something in Create React App? What happens if you create an app with npm and then eject? |
Yeah, it doesn't repro when I |
Let's file an issue with Yarn then. Or see if one already exists. |
@arcanis do you have any idea what might be going on here? I was going to file an issue with Yarn but I'm not even sure how to describe this problem succinctly. |
I think I'm hitting the same yarn bug in a project derived from CRA but I get it with different babel packages depending on the test case. Just as here, running npm or removing node_modules and rerunning yarn fixes the problem. It seems like yarn does not correctly verify the existing package tree somehow. |
My current understanding is that yarn does not completely verify the package tree when running yarn for existing dependencies. Combined with the very special case of removing a dependency while at the same time installing its dependencies as first hand dependencies makes it possible for some previously transitive dependence to not get flattened and therefor be impossible to reach from packages that have been flattened (as previously discovered by @heyimalex and @abel1105). I don't know if yarn skips this verification purposly for performance reasons or if it's a bug. But as this case should be incredibly uncommon it might be reasonable to skip it by default. However none of the yarn flags that I expected to help ( |
No idea, sorry. It's clear it shouldn't do this, though 😕 Efficient node_modules diffing is pretty hard, and part of the reason why I don't invest too much bandwidth in node_modules at the moment. Unless someone sends a PR for the v1, this bug will likely be fixed as part of the v2 rearchitecture work, which will make PnP the default install strategy. |
I'm not sure what the timeline is for v2 but I don't think this is a critical issue so we can probably wait. If someone wants to send a PR for v1 that would be great but it probably won't be me. I am curious to try this out with Yarn v2 though and see if it works. |
thanks, it worked for me too |
thanks with this line |
Upgrading babel core worked for me: |
a more tightly scoped workaround, inspired by the # delete the files on disk for the package with the problematic transitive dependency
rm -rf node_modules/babel-preset-react-app
# delete the lock file to force yarn to check all the first-level deps on disk
rm yarn.lock
# install again
yarn This approach is somewhat faster, since we don't need to delete all of our |
|
Also fix a create react app bug: facebook/create-react-app#6099.
* #113: Eject react app so tests can be ran. * #113: Add a test to test the test script. Also fix a create react app bug: facebook/create-react-app#6099. * #113: Add jest types for intellisense.
I've tried all the solutions posted above, but still having the issue:
I've installed
Tried numerous times to remove node_modules & reinstall. I've tried to add Does anyone have any other solution? My current babel config in package.json:
|
thanks, dude... |
For me the error was in VS Code only, so I had to add Seems not necessary when adding |
Is this a bug report?
Yes
Environment
Steps to Reproduce
npx create-react-app project
cd project
yarn eject
yarn build
Expected Behavior
Build success.
Actual Behavior
Build fails.
After eject, there's no
@babel/plugin-transform-react-jsx
module inside./node_modules
,./node_modules/babel-preset-react-app/node_modules
or./node_modules/babel-preset-react-app/node_modules/@babel/preset-react/node_modules
.I need to delete the whole
node_modules
and re-runyarn
to make it work.The text was updated successfully, but these errors were encountered: