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

Installing storybook for react-native fails because of error: "npm ERR! code EINVALIDTAGNAME" #12334

Closed
DPangerl opened this issue Sep 1, 2020 · 9 comments

Comments

@DPangerl
Copy link

DPangerl commented Sep 1, 2020

Describe the bug
Installing storybook for react-native with
npx -p @storybook/cli sb init --type react_native
leads to the following error:

sed: no such file or directory: storybook/storybook.js
npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "16.13.1@^16.13.1": Tags may not have any characters that encodeURIComponent encodes.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/daniel/.npm/_logs/2020-09-01T07_15_57_211Z-debug.log

To Reproduce
Execute npx -p @storybook/cli sb init --type react_native
At Do you want to install dependencies necessary to run Storybook server? submit yes or no

Expected behavior
Storybook gets installed correctly

System:

Environment Info:

  System:
    OS: macOS 10.15.6
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  Binaries:
    Node: 12.18.3 - ~/.nvm/versions/node/v12.18.3/bin/node
    npm: 6.14.6 - ~/.nvm/versions/node/v12.18.3/bin/npm
  Browsers:
    Chrome: 84.0.4147.135
    Firefox: 79.0
    Safari: 13.1.2

Additional context
I don't use expo for the react-native project

@saraikium
Copy link

Having the exact same issue. Hope somebody answers.

@shilman
Copy link
Member

shilman commented Sep 5, 2020

@dannyhw any chance you can take this one?

@dannyhw
Copy link
Member

dannyhw commented Sep 5, 2020

@shilman yeah I'll take a look.

@DPangerl @saraikium

If you want to try a workaround in the meantime something like this could work:

npx -p @storybook/cli@5.3.21 sb init --type react_native -y

Just make sure you change any dependencies from 6.x storybook to version 5.3.x because react native storybook doesn't support V6 yet.

Edit:
See my later comments for a quick fix on the deps.

@dannyhw dannyhw self-assigned this Sep 5, 2020
@dannyhw
Copy link
Member

dannyhw commented Sep 6, 2020

After trying this on a fresh project the following dependencies get installed

"@storybook/addon-actions": "^6.0.21",
"@storybook/addon-links": "^6.0.21",
 "@storybook/addons": "^6.0.21",
 "@storybook/react-native": "^5.3.21",
"@storybook/react-native-server": "^5.3.21",
"babel-loader": "^8.1.0",

It seems likely that the v6 deps are the problem

for future reference these are the steps I followed

expo init -t expo-template-blank-typescript
npx -p @storybook/cli@5.3.21 sb init --type react_native

Using expo or not shouldn't make a difference here.

@dannyhw
Copy link
Member

dannyhw commented Sep 6, 2020

This seems to work for me

yarn remove @storybook/addon-actions @storybook/addon-links @storybook/addons
yarn add @storybook/addon-actions@^5.3 @storybook/addon-links@^5.3 @storybook/addons@^5.3

Will see if I can fix the version of storybook dependencies of the init command to 5.x

@dannyhw
Copy link
Member

dannyhw commented Sep 6, 2020

@DPangerl I didn't get the same error that you got, could you share the contents of your package.json or perhaps create a reproduction branch

edit:

Actually tried this again with react native cli + mac. I did get the error this time, however you should be prompted to choose a version, if you choose 16.13.1 it should work. Will try to find out why this happens.

edit2:
I found the cause of the issue and I'm probably going to make a pr with various changes to fix the cli for the react native init.

@dannyhw
Copy link
Member

dannyhw commented Sep 7, 2020

#12405 should fix this issue and others related to the init for react native not working correctly.

@shilman
Copy link
Member

shilman commented Sep 10, 2020

Son of a gun!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.1.0-alpha.7 containing PR #12405 that references this issue. Upgrade today to try it out!

You can find this prerelease on the @next NPM tag.

Closing this issue. Please re-open if you think there's still more to do.

@shilman shilman closed this as completed Sep 10, 2020
@shilman
Copy link
Member

shilman commented Oct 3, 2020

¡Ay Caramba!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.0.25 containing PR #12405 that references this issue. Upgrade today to try it out!

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

4 participants