react-native: start-storybook crashes with: identifier.indexOf is not a function

Describe the bug Running start-storybook doesn’t work. Instead the process crashes and gives the following error:

/Users/loshan/Repos/{PROJECT_NAME_HERE}/node_modules/enhanced-resolve/lib/Resolver.js:254
                const idxQuery = identifier.indexOf("?");
                                            ^

TypeError: identifier.indexOf is not a function
    at Resolver.parse (/Users/loshan/Repos/{PROJECT_NAME_HERE}/node_modules/enhanced-resolve/lib/Resolver.js:254:31)
    at resolver.getHook.tapAsync (/Users/loshan/Repos/{PROJECT_NAME_HERE}/node_modules/enhanced-resolve/lib/ParsePlugin.js:16:28)
    at AsyncSeriesBailHook.eval [as callAsync] (eval at create (/Users/loshan/Repos/{PROJECT_NAME_HERE}/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:7:1)
    at Resolver.doResolve (/Users/loshan/Repos/{PROJECT_NAME_HERE}/node_modules/enhanced-resolve/lib/Resolver.js:235:16)
    at resolver.getHook.tapAsync (/Users/loshan/Repos/{PROJECT_NAME_HERE}/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:34:13)
    at AsyncSeriesBailHook.eval [as callAsync] (eval at create (/Users/loshan/Repos/{PROJECT_NAME_HERE}/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:7:1)
    at Resolver.doResolve (/Users/loshan/Repos/{PROJECT_NAME_HERE}/node_modules/enhanced-resolve/lib/Resolver.js:235:16)
    at resolver.getHook.tapAsync (/Users/loshan/Repos/{PROJECT_NAME_HERE}/node_modules/enhanced-resolve/lib/AliasFieldPlugin.js:43:13)
    at _next0 (eval at create (/Users/loshan/Repos/{PROJECT_NAME_HERE}/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:638:1)
    at _fn0 (eval at create (/Users/loshan/Repos/{PROJECT_NAME_HERE}/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:660:1)
    at resolver.getHook.tapAsync (/Users/loshan/Repos/{PROJECT_NAME_HERE}/node_modules/enhanced-resolve/lib/AliasPlugin.js:53:11)
    at AsyncSeriesBailHook.eval [as callAsync] (eval at create (/Users/loshan/Repos/{PROJECT_NAME_HERE}/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:652:1)
    at Resolver.doResolve (/Users/loshan/Repos/{PROJECT_NAME_HERE}/node_modules/enhanced-resolve/lib/Resolver.js:235:16)
    at DescriptionFileUtils.loadDescriptionFile (/Users/loshan/Repos/{PROJECT_NAME_HERE}/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:38:14)
    at forEachBail (/Users/loshan/Repos/{PROJECT_NAME_HERE}/node_modules/enhanced-resolve/lib/DescriptionFileUtils.js:51:12)
    at args (/Users/loshan/Repos/{PROJECT_NAME_HERE}/node_modules/enhanced-resolve/lib/forEachBail.js:30:14)

To Reproduce Steps to reproduce the behavior:

  1. Create new react-native project.
  2. $ npx -p @storybook/cli sb init --type react_native
  3. $ npm run storybook

Expected behavior Storybook should work.

System: Environment Info:

System: OS: macOS 10.14.6 CPU: (4) x64 Intel® Core™ i5-6500 CPU @ 3.20GHz Binaries: Node: 11.14.0 - ~/.nvm/versions/node/v11.14.0/bin/node Yarn: 1.17.3 - ~/.nvm/versions/node/v11.14.0/bin/yarn npm: 6.11.2 - ~/.nvm/versions/node/v11.14.0/bin/npm Browsers: Chrome: 76.0.3809.132 Firefox: 66.0.5 Safari: 12.1.2 npmPackages: @storybook/addon-actions: ^5.1.11 => 5.1.11 @storybook/addon-links: ^5.1.11 => 5.1.11 @storybook/addons: ^5.1.11 => 5.1.11 @storybook/react-native: ^5.1.11 => 5.1.11 @storybook/react-native-server: ^5.1.11 => 5.1.11 npmGlobalPackages: @storybook/cli: 5.1.11

Additional context This is a duplicate of issue https://github.com/storybookjs/storybook/issues/5223. Unfortunately that issue received no replies and was auto closed by the bot due to inactivity.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 11
  • Comments: 30 (6 by maintainers)

Most upvoted comments

still happening in 2021 :S

@samandarkuchkarov Rn nodeify seems really problematic have you tried something like the solution offered here https://github.com/WalletConnect/walletconnect-monorepo/issues/753 ?

Nodeify modifies all of the packages in node modules which really isn’t ideal and it’s essentially a hack. I thinks its breaking something for enhanced resolve in webpack.

Thank you, @dannyhw. I am successfully start storybook in clear project and after debugging my dependencies I find that dev dependence rn-nodeify is main reason of error. If I add project this and run yarn storybook error appeared https://github.com/samandarkuchkarov/storybook-bug-example