storybookjs / react-native

📓 Storybook for React Native!
https://storybook.js.org
MIT License
995 stars 142 forks source link

examples/expo-example: does not install out of the box #577

Closed the-simian closed 3 weeks ago

the-simian commented 3 weeks ago

Describe the bug run npm install in examples/expo-example and you'' get peer depenency errors

npm ERR! While resolving: expo-example@7.6.19
npm ERR! Found: react@18.2.0
npm ERR! node_modules/react
npm ERR!   react@"18.2.0" from expo-example@7.6.19
npm ERR!   examples/expo-example
npm ERR!     expo-example@7.6.19
npm ERR!     node_modules/expo-example
npm ERR!       workspace examples/expo-example from the root project
npm ERR!   peer react@">=16.8.0" from @testing-library/react-native@12.4.3
npm ERR!   node_modules/@testing-library/react-native
npm ERR!     dev @testing-library/react-native@"12.4.3" from expo-example@7.6.19
npm ERR!     examples/expo-example
npm ERR!       expo-example@7.6.19
npm ERR!       node_modules/expo-example
npm ERR!         workspace examples/expo-example from the root project
npm ERR!   1 more (react-native)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^18.3.1" from react-test-renderer@18.3.1
npm ERR! node_modules/react-test-renderer
npm ERR!   peer react-test-renderer@">=16.8.0" from @testing-library/react-native@12.4.3
npm ERR!   node_modules/@testing-library/react-native
npm ERR!     dev @testing-library/react-native@"12.4.3" from expo-example@7.6.19
npm ERR!     examples/expo-example
npm ERR!       expo-example@7.6.19
npm ERR!       node_modules/expo-example
the-simian commented 3 weeks ago

I can get this to work with

{
  "name": "expo-example",
  "version": "7.6.20",
  "private": true,
  "main": "index.js",
  "scripts": {
    "android": "STORYBOOK_ENABLED=true expo start --android",
    "ios": "STORYBOOK_ENABLED=true expo start --ios",
    "web": "STORYBOOK_ENABLED=true expo start --web",
    "storybook:mobile": "STORYBOOK_ENABLED=true expo start",
    "storybook:web": "storybook dev -p 6006 -c ./.storybook-web",
    "build-web-storybook": "storybook build -c ./.storybook-web",
    "storybook-getstories": "sb-rn-get-stories --config-path=./.storybook --v6-store",
    "storybook-generate": "sb-rn-get-stories --config-path=./.storybook",
    "storybook-watcher": "sb-rn-watcher -v6 --config-path=./.storybook",
    "disabled-example": "expo start",
    "format": "prettier --write .",
    "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
    "check": "tsc --noEmit",
    "test": "jest",
    "test:ci": "jest --runInBand"
  },
  "dependencies": {
    "@expo/metro-runtime": "~3.1.3",
    "@react-native-async-storage/async-storage": "1.21.0",
    "@react-native-community/datetimepicker": "7.7.0",
    "@react-native-community/slider": "4.4.2",
    "@storybook/addon-essentials": "^7.6.13",
    "@storybook/addon-interactions": "^7.6.13",
    "@storybook/addon-knobs": "^7.0.2",
    "@storybook/addon-links": "^7.6.13",
    "@storybook/addon-ondevice-actions": "^7.6.19",
    "@storybook/addon-ondevice-backgrounds": "^7.6.19",
    "@storybook/addon-ondevice-controls": "^7.6.19",
    "@storybook/addon-ondevice-knobs": "^7.6.19",
    "@storybook/addon-ondevice-notes": "^7.6.19",
    "@storybook/addon-react-native-server": "0.0.5--canary.3.18ef8d7.0",
    "@storybook/addon-react-native-web": "^0.0.22",
    "@storybook/blocks": "^7.6.13",
    "@storybook/builder-webpack5": "^7.6.13",
    "@storybook/core-common": "^7.6.13",
    "@storybook/docs-tools": "^7.6.13",
    "@storybook/global": "^5.0.0",
    "@storybook/react": "^7.6.13",
    "@storybook/react-native": "^7.6.19",
    "@storybook/react-webpack5": "^7.6.13",
    "@storybook/test": "^7.6.13",
    "expo": "^50.0.2",
    "querystring": "^0.2.1",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "0.73.6",
    "react-native-safe-area-context": "4.8.2",
    "react-native-web": "~0.19.6",
    "storybook": "^7.6.13",
    "ws": "^8.16.0"
  },
  "resolutions": {
    "react": "18.2.0"
  },
  "devDependencies": {
    "@babel/core": "^7.19.3",
    "@babel/plugin-proposal-export-namespace-from": "^7.18.9",
    "@react-native/babel-preset": "^0.74.0",
    "@testing-library/react-native": "12.5.1",
    "@types/react": "~18.2.45",
    "@types/react-test-renderer": "^18.0.7",
    "@types/ws": "^8.5.10",
    "babel-plugin-react-docgen-typescript": "^1.5.1",
    "jest": "29.7.0",
    "jest-expo": "~50.0.4",
    "metro-react-native-babel-preset": "^0.77.0",
    "react-test-renderer": "18.2.0",
    "ts-node": "^10.9.1",
    "typescript": "^5.3.3"
  },
  "jest": {
    "preset": "jest-expo",
    "setupFilesAfterEnv": [
      "<rootDir>/setup-jest.ts"
    ]
  }
}
dannyhw commented 3 weeks ago

the repo is a yarn workspace and shouldn't be used with npm, you should run yarn install in the root of the workspace