Skip to content
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

(0, _typeof4.default) is not a function #1678

Closed
thekevinbrown opened this issue Aug 18, 2017 · 19 comments
Closed

(0, _typeof4.default) is not a function #1678

thekevinbrown opened this issue Aug 18, 2017 · 19 comments

Comments

@thekevinbrown
Copy link

thekevinbrown commented Aug 18, 2017

Unfortunately even on 3.2.5 I'm still getting the issue from #1665. I'm no longer as strongly convinced that it's babel config.

Reproduction steps:

I'll keep digging on my side, but unfortunately this isn't resolved yet. Does anyone have any ideas? I can't seem to figure out what's causing it, and running react-native run-ios without Storybook works.

@thekevinbrown
Copy link
Author

thekevinbrown commented Aug 18, 2017

I commented out a bunch of code in storybook.js and this issue only appears when the getStorybookUI function gets called, even with no stories loaded. I experimented with renaming .babelrc to something else to try to force storybook to use its own built in babel config, and it stopped saying it was loading the project .babelrc but I still got this error.

All of this experimentation is with the built it in example stories, not any of my own components, which seems to exclude async / await from being the problem.

@thekevinbrown
Copy link
Author

I also created a fresh new project with react-native init to see if I could reproduce the issue and it worked fine. So I went back to the project and did a clean attempt, which didn't work, failing with this:
screen shot 2017-08-19 at 12 01 56 am

I'll now be taking my working empty project and adding more and more from the broken project until I can get it to break. I'll report back with findings.

@thekevinbrown
Copy link
Author

This may be related to a cache somewhere. I can get this to work with all the same dependencies in a fresh project. I'll keep chipping away at it, but any ideas would be amazing!

@vtsatskin
Copy link

Hey @blargity, I'm experiencing the same problem on my own project using the steps you discussed. Here's my dependencies list and various versions of things I'm using.

I've tried removing my .babelrc file to see if this fixes it, no luck. I've also tried editing my .babelrc to include the babel-preset-env configuration with no luck:

{
  "presets": ["react-native", "env"]
}

@danielduan
Copy link
Member

@vtsatskin the latest babelrc should contain in 3.2.5 should contain [env, react-native, stage-0]. might be worth cleaning out your npm directory and doing a fresh install.

@vtsatskin
Copy link

I've tried updating my .babelrc in both the root folder and inside of /storybook with the following contents:

{
  "presets": ["env", "react-native", "stage-0"]
}

Following your suggestions (and also trying to upgrade the babel preset packages) does not fix the issue. I've also run this with and without a .babelrc in both the project root and inside of /storybook:

rm -rf node_modules
yarn install
yarn upgrade babel-preset-react-native
yarn upgrade babel-preset-stage-0
yarn run storybook

# different terminal
react-native run-ios

From my understanding, isn't storybook on react native supposed to run properly on a device when given no .babelrc file? Under what situations should a custom .babelrc file be supplied?

@danielduan
Copy link
Member

I'm gonna have to apologize and suggest you try to revert back to 3.2.3 if you need to have it working asap. I saw that your package.json had react@16 in it.

We added a dependency for react-native backwards compatibility in 3.2.4 that broke storybook react-native when used with react@16-beta because it accessed PropTypes from the React package.

They've been fixed since, but we're still fixing a few other things that are broken on the master branch before publishing the next patch release. I know it's frustrating, I've been waiting on it as well.
#1673
#1674

@vtsatskin
Copy link

Hey @danielduan, I'm not frustrated at all and thanks for all your help!

I've tried integrating with 3.2.3 and it still didn't work. I performed the following:

yarn global add @storybook/[email protected]
rm -rf node_modules
yarn install
getstorybook
yarn upgrade babel-preset-react-native
yarn upgrade babel-preset-stage-0

I've also edited the .babelrc file to the previously mentioned presets. I've additionally tried with no .babelrc, and the same file in /storybook.

@danielduan
Copy link
Member

@vtsatskin you should go into your package.json and change @storybook/react-native version to 3.2.3 and then remove node_modules and yarn install.

the @storybook/cli package is only to create the project for you. Itt will install the latest version of Storybook out there regardless which version of the cli you use.

@vtsatskin
Copy link

@danielduan I just tried that, still no luck.

@danielduan
Copy link
Member

@vtsatskin does 3.2.6 fix it for you?

@thekevinbrown
Copy link
Author

@danielduan I'll give it a shot too.

@qwert666
Copy link

@danielduan 3.2.6 doesn't help either

@danielduan
Copy link
Member

danielduan commented Aug 28, 2017

Does anyone have a project I can clone on github to test this out?

Really apologize for the bug, there's been a lot of issues we ironed out over the last few patch releases. I believe 3.2.9 is the latest now.

@GantMan
Copy link

GantMan commented Sep 1, 2017

I had the same exact bug, but got passed it.

I removed all my storybook node modules and did:
npm i @storybook/cli @storybook/react @storybook/react-native

no clue why, but it just started working. @qwert666 - I wish you the same strange luck!

@danielduan
Copy link
Member

There was an issue with the cli not installing the @storybook/react-native package that we fixed. #1738 Might be related?

@stale
Copy link

stale bot commented Nov 2, 2017

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. We do try to do some housekeeping every once in a while so inactive issues will get closed after 90 days. Thanks!

@stale stale bot added the inactive label Nov 2, 2017
@holmesal
Copy link

holmesal commented Nov 2, 2017

This seems like it's a caching issue for me as well. I was having this issue and wasn't getting a good stack trace, so I started dropping console.log()s at getStorybookUI to find the failing line.

As soon as I got to node_modules/react-inspector/node_modules/babel-runtime/helpers/possibleConstructorReturn.js it miraculously started working again. Unclear why.

@stale stale bot removed the inactive label Nov 2, 2017
@danielduan
Copy link
Member

I'm going to close this issue for now because there's no real reproduction of this. Maybe the solution is to just remove all node_module files and delete the lock files and reinstall.

If someone has a repro on Github, please comment back and we'll reopen the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants