Closed md-seb closed 3 years ago
The following fixes it for me:
rm yarn.lock && yarn
I think there's a babel version inconsistency between CRA@4 and Storybook@6, but I'm not sure what's the proper fix.
NOTE: this is hopefully fixed in 6.1 βοΈ . We need to get it back into the stable release, but are having problems with repros in CI. In the meantime if people can upgrade to 6.1 to test it out, please give it a try and report back:
npx sb upgrade --prerelease
If it doesn't work right away, try removing regenerating lockfiles.
I'm getting the same problem. But for me I started to see You gave us a visitor for the node type StaticBlock but it's not a valid type
error after upgrading to 6.1 from 6.0.26.
Seeing this reliably when upgrading from 6.1.0-alpha.22 to 6.1.1 βΒ regenerating the lockfile doesnβt help. Weβre not using CRA, but we are using babel for building our code outside of Storybook. Iβll update if I find a specific Babel version/config that fixes the issue.
Removing node_modules
fixed the issue for me.
Rebuilding my yarn.lock was not enough. Here's why:
StaticBlock
).@babel/helper-replace-supers
βΒ but it looks to make sure the StaticBlock node type is available in @babel/types
before adding the visitor.@babel/traverse
, the StaticBlock node type is mysteriously gone. This is because @babel/helper-replace-supers
and @babel/traverse
use different installations of @babel/types
.@babel/helper-replace-supers
had v7.12.1 installed at ./node_modules/@storybook/core/node_modules/@babel/types
, while @babel/traverse
was using the older v7.11.0 at ./node_modules/@storybook/core/node_modules/@babel/traverse/node_modules/@babel/types
.@babel/traverse
has the correct dependency specified it's just a matter of replacing node_modules.I think it's safe to mark this closed.
Great detective work @koop. Thanks so much, closing!
Same here, just rm yarn.lock && yarn
did not work but also deleting node_modules
did the trick.
Run from the app directory:
rm -rf ./node_modules && rm yarn.lock && yarn
rm -rf ./node_modules && yarn install --force
worked for me without removing yarn.lock
My error is
Error: [BABEL] /vercel/path0/src/index.tsx: You gave us a visitor for the node type TSInstantiationExpression but it's not a valid type
but none of the indications worked for me :(
My error is
Error: [BABEL] /vercel/path0/src/index.tsx: You gave us a visitor for the node type TSInstantiationExpression but it's not a valid type
but none of the indications worked for me :(
Getting this same issue on a new expo typescript project
@tjweihra what's the version of your react-scripts package? I updated mine to 5.0.1 and it solved. But now I have a new error:
Module not found: Error: Can't resolve '/vercel/path0/node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js' in '/vercel/path0/src/styles
@lucasfelixc I just found the issue, my global npm version for expo-cli was 4.x.x, after upgrading i'm now on version 5.4.6. It seems to have fixed my issue, apologies if that doesn't help.
node_modules\@react-navigation\native\src\index.tsx: [BABEL] E:\development\zionet\react-native\expo-cli\flights\node_modules\@react-navigation\native\src\index.tsx: You gave us a visitor for the node type TSInstantiationExpression but it's not a valid type
this is my error today, 2 days ago all worked fine while opened projects... today every project this error :( will be thanksfull for help.
tjweihra
update the global expo looks like it work, tnx a lot!
I got :
Error: [BABEL] /**/client/src/index.tsx: You gave us a visitor for the node type TSInstantiationExpression but it's not a valid type
at Generator.next (<anonymous>)
at Generator.next (<anonymous>)
Still don't get what is the problem. I try to update the react-scripts to "5.0.0"
You gave us a visitor for the node type TSInstantiationExpression
I've received the same error during global update of project packages. It means babel
runtime or one of its part is too old. You have to keep react-script
3.4.4
for now and try to update other packages. The same scenario should be used for other packages.
You should estimate large amount of time for any project packages update. For my case: I should find an ideal balance between 6800 package dependecies (including parts of babel).
I started getting the same error today (worked fine yesterday):
You gave us a visitor for the node type TSInstantiationExpression but it's not a valid type
In my case, I use babel programmatically to compile typescript. I don't use react-script
nor expo-cli
. so none of the solutions above could help.
Edit: many babel packages were updated to 7.18.0 yesterday. One of the merged PRs is Add support for instantiation expressions , it might be related.
2 days ago was working, now babel broke the internet. I just wasted a day and still unresolved. I'm getting the error in a Next.js project using (expo) & babel.
I updated Expo-cli to 5.4.6 and all that is suggested above, no solution.
Error: [BABEL] .../pages/_app.tsx: You gave us a visitor for the node type TSInstantiationExpression but it's not a valid type
at Generator.next (<anonymous>)
Any solution even temporary?
Forcing @babel/core and @babel/types back to version 7.17 fixed the issue for me, although it feels hacky...
Add the resolutions to package.json:
"resolutions": {
"@babel/core": "7.17.12",
"@babel/types": "7.17.12"
}
Then rm -rf node_modules && yarn
Cannot run storybook in a vanilla create-react-app. It appears to install correctly, but fails on
npm run storybook
To Reproduce
cd /tmp && npx create-react-app storytest && cd storytest && npx sb init && npm run storybook
Expected behavior Storybook is running
Code snippets Full log:
System
Additional context None