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

[Bug]: storybook init fails in React Native when the project already has some dependencies #25902

Closed
yannbf opened this issue Feb 5, 2024 · 3 comments · Fixed by #25908
Closed

Comments

@yannbf
Copy link
Member

yannbf commented Feb 5, 2024

Describe the bug

Storybook init for React Native adds a combination of dependencies, which seem to be the renderer + addons + the peer dependencies of the addons:

'react-native-safe-area-context',
'@react-native-async-storage/async-storage',
'@react-native-community/datetimepicker',
'@react-native-community/slider',
'@storybook/addon-ondevice-controls',
'@storybook/addon-ondevice-actions',
'@storybook/react-native',

However storybook init tries to add them at a particular version and that causes YARN2 error as they are already installed, thus storybook init fails.

These were the deps in my project which caused the failure:

"dependencies": {
    "@expo/webpack-config": "^19.0.0",
    "@react-native-async-storage/async-storage": "1.18.2",
    "@react-native-picker/picker": "2.4.10",
    "@react-navigation/bottom-tabs": "^6.5.11",
    "@react-navigation/native": "^6.1.9",
    "@reduxjs/toolkit": "^1.9.7",
    "@types/react": "~18.2.14",
    "@types/react-native": "~0.72.6",
    "expo": "^49.0.18",
    "expo-av": "~13.4.1",
    "expo-linear-gradient": "~12.3.0",
    "expo-status-bar": "~1.6.0",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "0.72.6",
    "react-native-calendars": "^1.1302.0",
    "react-native-linear-gradient": "^2.8.3",
    "react-native-picker-select": "^9.0.0",
    "react-native-safe-area-context": "4.6.3",
    "react-native-screens": "~3.22.0",
    "react-native-web": "~0.19.6",
    "react-redux": "^8.1.3",
    "redux-persist": "^6.0.0",
    "typescript": "^5.1.3"
  },

To Reproduce

No response

System

No response

Additional context

No response

@dannyhw
Copy link
Member

dannyhw commented Feb 5, 2024

@yannbf thanks for spotting this I think I can fix it

@dannyhw
Copy link
Member

dannyhw commented Feb 5, 2024

@yannbf btw for npm I get an install error since that version of async storage has a peer dep that doesn't match your react native version

npm ERR! Could not resolve dependency:
npm ERR! peer react-native@"^0.0.0-0 || 0.60 - 0.72 || 1000.0.0" from @react-native-async-storage/[email protected]
npm ERR! node_modules/@react-native-async-storage/async-storage
npm ERR!   @react-native-async-storage/async-storage@"1.18.2" from the root project

@dannyhw
Copy link
Member

dannyhw commented Feb 5, 2024

#25908 will fix your error though

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

Successfully merging a pull request may close this issue.

3 participants