storybookjs / react-native

📓 Storybook for React Native!
https://storybook.js.org
MIT License
1.07k stars 155 forks source link

yarn storybook ModuleNotFoundError: #467

Closed PElfimov closed 1 year ago

PElfimov commented 1 year ago

Im trying upgrade RN storybook from 5.3 to 6.5 after yarn storybook i caught a bug

Please help me

ModuleNotFoundError: Module not found: Error: Can't resolve 'react-native-web/dist/exports/StyleSheet' in '/Users/pelfimov/work/newton/frontend/projects/mobile/src/NTDesign/Button' at /Users/pelfimov/work/newton/frontend/projects/mobile/node_modules/@storybook/builder-webpack5/node_modules/webpack/lib/Compilation.js:2016:28 at /Users/pelfimov/work/newton/frontend/projects/mobile/node_modules/@storybook/builder-webpack5/node_modules/webpack/lib/NormalModuleFactory.js:805:13

image

{
    "name": "mobile",
    "version": "1.0.0",
    "private": true,
    "scripts": {
        "android": "react-native run-android",
        "ios": "react-native run-ios",
        "start": "react-native start",
        "storybook-watcher": "sb-rn-watcher --config-path .ondevice",
        "storybook": "start-storybook -p 7007",
        "build-storybook": "build-storybook",
        "storybook-metro": "react-native start --config ./.storybook/metro.storybook.js",
        "prestorybook": "rnstl"
    },
    "engines": {
        "node": "^16.0.0"
    },

    "devDependencies": {
        "@babel/core": "7.12.9",
        "@babel/runtime": "7.12.5",
        "@react-native-async-storage/async-storage": "1.18.1",
        "@react-native-community/cli": "7.0.3",
        "@react-native-community/datetimepicker": "7.0.1",
        "@react-native-community/eslint-config": "3.2.0",
        "@react-native-community/slider": "4.4.2",
        "@storybook/addon-actions": "6.5.16",
        "@storybook/addon-controls": "6.5.16",
        "@storybook/addon-essentials": "6.5.14",
        "@storybook/addon-links": "6.5.14",
        "@storybook/addon-ondevice-actions": "6.5.3",
        "@storybook/addon-ondevice-backgrounds": "6.5.1",
        "@storybook/addon-ondevice-controls": "6.5.3",
        "@storybook/addon-ondevice-notes": "6.5.1",
        "@storybook/addon-react-native-web": "0.0.19",
        "@storybook/builder-webpack5": "6.5.16",
        "@storybook/manager-webpack5": "6.5.16",
        "@storybook/react": "6.5.14",
        "@storybook/react-native": "6.5.3",
        "@swc/core": "1.2.135",
        "@swc/jest": "0.2.17",
        "@testing-library/jest-native": "4.0.4",
        "@testing-library/react-hooks": "8.0.1",
        "@testing-library/react-native": "9.0.0",
        "@types/color": "3.0.1",
        "@types/enzyme": "3.10.4",
        "@types/jest": "27.4.0",
        "@types/react": "17.0.2",
        "@types/react-native": "0.65.8",
        "@types/react-native-tab-view": "2.3.0",
        "@types/react-native-touch-id": "4.0.1",
        "@types/react-redux": "7.1.5",
        "@types/react-test-renderer": "16.9.2",
        "@types/recompose": "0.30.7",
        "@types/styled-components": "5.1.0",
        "@types/styled-components-react-native": "5.1.0",
        "@typescript-eslint/eslint-plugin": "5.56.0",
        "@typescript-eslint/experimental-utils": "5.56.0",
        "@typescript-eslint/parser": "5.56.0",
        "ansi-colors": "4.1.3",
        "babel-jest": "27.5.1",
        "babel-loader": "8.3.0",
        "babel-plugin-module-resolver": "4.0.0",
        "babel-plugin-react-docgen-typescript": "1.5.1",
        "babel-plugin-react-native-web": "0.18.10",
        "babel-plugin-rewrite-require": "1.14.5",
        "babel-plugin-transform-remove-console": "6.9.4",
        "chalk": "3.0.0",
        "concurrently": "7.2.2",
        "detox": "19.7.1",
        "eslint": "8.36.0",
        "eslint-config-prettier": "8.8.0",
        "eslint-import-resolver-typescript": "3.5.3",
        "eslint-plugin-import": "2.27.5",
        "eslint-plugin-import-helpers": "1.3.1",
        "eslint-plugin-prettier": "3.4.0",
        "eslint-plugin-react": "7.32.2",
        "eslint-plugin-react-hooks": "4.6.0",
        "fs-extra": "9.1.0",
        "http-proxy": "1.18.1",
        "jest": "27.5.1",
        "jetifier": "1.6.5",
        "metro": "0.67.0",
        "metro-core": "0.67.0",
        "metro-react-native-babel-preset": "0.67.0",
        "msw": "0.38.1",
        "prettier": "2.3.2",
        "promise.prototype.finally": "3.1.3",
        "react-dom": "18.2.0",
        "react-native-flipper": "0.146.1",
        "react-native-storybook-loader": "2.0.5",
        "react-native-typescript-transformer": "1.2.13",
        "react-test-renderer": "17.0.2",
        "readline": "1.3.0",
        "redux-flipper": "1.4.0",
        "replace-in-file": "5.0.2",
        "ts-jest": "27.1.3",
        "typescript": "4.9.5"
    },

        "test-runner": "jest"
    },
dannyhw commented 1 year ago

This would be better suited to the addon-react-native-web repo since its not an error from the native version.

However the problem seems to be that you are missing some dependencies. For example I don't see react native web in your dependencies.

PElfimov commented 1 year ago

yes thanks i missed it