react-native
react-native copied to clipboard
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:
- Create new react-native project.
$ npx -p @storybook/cli sb init --type react_native$ npm run storybook
Expected behavior Storybook should work.
System: Environment Info:
System: OS: macOS 10.14.6 CPU: (4) x64 Intel(R) Core(TM) 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.
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!
Can't believe this one is ignored. Having the same problem and it's blocking me half of the day. Any luck? @losh11
No update @fozhao
Running into this too. Had it working in a previous node_modules state which I can't now recreate, if that's any clue to anyone.
I need to set aside the problem for now; here's the diff list of the working node_modules (node_modules.works) and the broken one (node_modules.broke). I'll hold on to the folder, feel free to ping me if anyone wants to see the specific diff of one of these files:
Only in node_modules.works/.cache/storybook: records.json
Only in node_modules.broke/@reach/router/node_modules: react
Only in node_modules.works/@storybook/react-native-server/node_modules/@storybook/core/dist: public
Files node_modules.works/are-we-there-yet/node_modules/readable-stream/readable.js and node_modules.broke/are-we-there-yet/node_modules/readable-stream/readable.js differ
Files node_modules.works/assert/assert.js and node_modules.broke/assert/assert.js differ
Files node_modules.works/bl/node_modules/readable-stream/lib/_stream_readable.js and node_modules.broke/bl/node_modules/readable-stream/lib/_stream_readable.js differ
Files node_modules.works/bl/node_modules/readable-stream/lib/_stream_writable.js and node_modules.broke/bl/node_modules/readable-stream/lib/_stream_writable.js differ
Files node_modules.works/bl/node_modules/readable-stream/readable.js and node_modules.broke/bl/node_modules/readable-stream/readable.js differ
Files node_modules.works/concat-stream/node_modules/readable-stream/readable.js and node_modules.broke/concat-stream/node_modules/readable-stream/readable.js differ
Files node_modules.works/crypto-browserify/node_modules/pbkdf2/lib/default-encoding.js and node_modules.broke/crypto-browserify/node_modules/pbkdf2/lib/default-encoding.js differ
Files node_modules.works/duplexify/node_modules/readable-stream/readable.js and node_modules.broke/duplexify/node_modules/readable-stream/readable.js differ
Files node_modules.works/extract-zip/node_modules/readable-stream/readable.js and node_modules.broke/extract-zip/node_modules/readable-stream/readable.js differ
Files node_modules.works/flush-write-stream/node_modules/readable-stream/readable.js and node_modules.broke/flush-write-stream/node_modules/readable-stream/readable.js differ
Files node_modules.works/from2/node_modules/readable-stream/readable.js and node_modules.broke/from2/node_modules/readable-stream/readable.js differ
Files node_modules.works/fs-write-stream-atomic/node_modules/readable-stream/readable.js and node_modules.broke/fs-write-stream-atomic/node_modules/readable-stream/readable.js differ
Files node_modules.works/fsevents/node_modules/node-pre-gyp/node_modules/.bin/semver and node_modules.broke/fsevents/node_modules/node-pre-gyp/node_modules/.bin/semver differ
Files node_modules.works/fsevents/node_modules/readable-stream/readable.js and node_modules.broke/fsevents/node_modules/readable-stream/readable.js differ
Files node_modules.works/fsevents/node_modules/semver/README.md and node_modules.broke/fsevents/node_modules/semver/README.md differ
Files node_modules.works/fsevents/node_modules/semver/bin/semver and node_modules.broke/fsevents/node_modules/semver/bin/semver differ
Files node_modules.works/fsevents/node_modules/semver/semver.js and node_modules.broke/fsevents/node_modules/semver/semver.js differ
Files node_modules.works/fwd-stream/node_modules/readable-stream/lib/_stream_readable.js and node_modules.broke/fwd-stream/node_modules/readable-stream/lib/_stream_readable.js differ
Files node_modules.works/fwd-stream/node_modules/readable-stream/lib/_stream_writable.js and node_modules.broke/fwd-stream/node_modules/readable-stream/lib/_stream_writable.js differ
Files node_modules.works/fwd-stream/node_modules/readable-stream/readable.js and node_modules.broke/fwd-stream/node_modules/readable-stream/readable.js differ
Files node_modules.works/get-uri/node_modules/readable-stream/readable.js and node_modules.broke/get-uri/node_modules/readable-stream/readable.js differ
Files node_modules.works/htmlparser2/node_modules/readable-stream/readable.js and node_modules.broke/htmlparser2/node_modules/readable-stream/readable.js differ
Files node_modules.works/levelup/lib/util.js and node_modules.broke/levelup/lib/util.js differ
Files node_modules.works/levelup/node_modules/readable-stream/lib/_stream_readable.js and node_modules.broke/levelup/node_modules/readable-stream/lib/_stream_readable.js differ
Files node_modules.works/levelup/node_modules/readable-stream/lib/_stream_writable.js and node_modules.broke/levelup/node_modules/readable-stream/lib/_stream_writable.js differ
Files node_modules.works/levelup/node_modules/readable-stream/readable.js and node_modules.broke/levelup/node_modules/readable-stream/readable.js differ
Files node_modules.works/memory-fs/node_modules/readable-stream/readable.js and node_modules.broke/memory-fs/node_modules/readable-stream/readable.js differ
Files node_modules.works/merge-stream/node_modules/readable-stream/readable.js and node_modules.broke/merge-stream/node_modules/readable-stream/readable.js differ
Files node_modules.works/mississippi/node_modules/readable-stream/readable.js and node_modules.broke/mississippi/node_modules/readable-stream/readable.js differ
Files node_modules.works/node-libs-browser/node_modules/assert/assert.js and node_modules.broke/node-libs-browser/node_modules/assert/assert.js differ
Files node_modules.works/node-libs-browser/node_modules/readable-stream/readable.js and node_modules.broke/node-libs-browser/node_modules/readable-stream/readable.js differ
Files node_modules.works/node-libs-browser/node_modules/stream-browserify/index.js and node_modules.broke/node-libs-browser/node_modules/stream-browserify/index.js differ
Files node_modules.works/parallel-transform/node_modules/readable-stream/readable.js and node_modules.broke/parallel-transform/node_modules/readable-stream/readable.js differ
Files node_modules.works/parse-asn1/node_modules/pbkdf2/lib/default-encoding.js and node_modules.broke/parse-asn1/node_modules/pbkdf2/lib/default-encoding.js differ
Only in node_modules.works/react-native/scripts: .packager.env
Only in node_modules.works/react-native: third-party
Files node_modules.works/react-native-crypto/node_modules/pbkdf2/browser.js and node_modules.broke/react-native-crypto/node_modules/pbkdf2/browser.js differ
Files node_modules.works/readable-stream/lib/_stream_readable.js and node_modules.broke/readable-stream/lib/_stream_readable.js differ
Files node_modules.works/readable-stream/lib/_stream_writable.js and node_modules.broke/readable-stream/lib/_stream_writable.js differ
Files node_modules.works/readdirp/node_modules/readable-stream/readable.js and node_modules.broke/readdirp/node_modules/readable-stream/readable.js differ
Files node_modules.works/socketcluster/sample/node_modules/readable-stream/readable.js and node_modules.broke/socketcluster/sample/node_modules/readable-stream/readable.js differ
Files node_modules.works/socketcluster/sample/node_modules/socketcluster/sample/node_modules/debug/browser.js and node_modules.broke/socketcluster/sample/node_modules/socketcluster/sample/node_modules/debug/browser.js differ
Files node_modules.works/socketcluster/sample/node_modules/socketcluster/sample/node_modules/readable-stream/readable.js and node_modules.broke/socketcluster/sample/node_modules/socketcluster/sample/node_modules/readable-stream/readable.js differ
Files node_modules.works/stream-browserify/index.js and node_modules.broke/stream-browserify/index.js differ
Files node_modules.works/stream-http/node_modules/readable-stream/readable.js and node_modules.broke/stream-http/node_modules/readable-stream/readable.js differ
Files node_modules.works/superagent/node_modules/readable-stream/readable.js and node_modules.broke/superagent/node_modules/readable-stream/readable.js differ
Files node_modules.works/through2/node_modules/readable-stream/readable.js and node_modules.broke/through2/node_modules/readable-stream/readable.js differ
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!
Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!
This issue is not resolved
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!
Same issue here!
same issue, has anyone found any working solution for this.
same issue
I'm thinking that something is missing in the docs. I added a simple console.log in the enhanced-resolve/lib/Resolver.js and the line with indexOf receives a function.
I guess that we need some kind of config in babel.config to properly resolve the dependencies.
Ok, just for the protocol. I did a clean RN installation and then installed storybook. Server starts fine.
So it must be something in our project that is incompatible.
Same issue.
Somebody can create reproducible test repo?
still happening in 2021 :S
Any details about this issue? Or a reproduction?
Ran into this today, had it working for a moment, then it broke again. Not sure what the cause is.
If someone can provide a repo with a reproduction or provide steps to reproduce that would help with debugging this.
still happening
Still looking for a reproduction of this. If you have time please provide an example project with the broken behaviour and steps on how to reproduce.
I have same issue undefined error ... indexOf.
i found that some library like react-native-localize, i18n-js, import {mergeAll, flatten} from 'ramda'; occurs error.
My Custom component use it. but after remove these library, storybook renders well.
same here:
TypeError: identifier.indexOf is not a function
No solutions yet?
@Markuson any chance you can provide a public reproduction of this? Or could you provide the steps to reproduce?
same error
I would love to help with this but its not helpful when no-one is able to provide a reproduction. Please provide an example project with the problem easily reproducible so that I can more easily debug it. Its honestly getting pretty frustrating now how many times I already asked with no response...
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
@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.