react-native icon indicating copy to clipboard operation
react-native copied to clipboard

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

Open losh11 opened this issue 6 years ago • 26 comments

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(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.

losh11 avatar Sep 02 '19 07:09 losh11

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!

stale[bot] avatar Sep 23 '19 09:09 stale[bot]

Can't believe this one is ignored. Having the same problem and it's blocking me half of the day. Any luck? @losh11

fozhao avatar Sep 26 '19 09:09 fozhao

No update @fozhao

losh11 avatar Sep 26 '19 15:09 losh11

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.

mphasak avatar Sep 27 '19 01:09 mphasak

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

mphasak avatar Sep 27 '19 02:09 mphasak

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!

stale[bot] avatar Oct 18 '19 03:10 stale[bot]

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!

stale[bot] avatar Nov 17 '19 03:11 stale[bot]

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!

stale[bot] avatar Dec 17 '19 05:12 stale[bot]

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!

stale[bot] avatar Jan 07 '20 07:01 stale[bot]

Same issue here!

slavik0329 avatar Feb 19 '20 05:02 slavik0329

same issue, has anyone found any working solution for this.

ahmadaafaq avatar May 14 '20 04:05 ahmadaafaq

same issue

markwindsorr avatar May 21 '20 22:05 markwindsorr

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.

compojoom avatar May 27 '20 05:05 compojoom

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.

compojoom avatar May 27 '20 06:05 compojoom

Same issue.

singhvivek2503 avatar Jun 25 '20 15:06 singhvivek2503

Somebody can create reproducible test repo?

alexander-akait avatar Jul 16 '20 15:07 alexander-akait

still happening in 2021 :S

jellyfish-tom avatar Mar 29 '21 14:03 jellyfish-tom

Any details about this issue? Or a reproduction?

dannyhw avatar Oct 29 '21 22:10 dannyhw

Ran into this today, had it working for a moment, then it broke again. Not sure what the cause is.

talon-i-am avatar Nov 23 '21 17:11 talon-i-am

If someone can provide a repo with a reproduction or provide steps to reproduce that would help with debugging this.

dannyhw avatar Nov 24 '21 19:11 dannyhw

still happening

jellyfish-tom avatar Dec 23 '21 10:12 jellyfish-tom

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.

dannyhw avatar Dec 23 '21 12:12 dannyhw

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.

Einere avatar Feb 15 '22 06:02 Einere

same here: TypeError: identifier.indexOf is not a function

No solutions yet?

Markuson avatar Aug 29 '22 11:08 Markuson

@Markuson any chance you can provide a public reproduction of this? Or could you provide the steps to reproduce?

dannyhw avatar Aug 29 '22 16:08 dannyhw

same error

samandarkuchkarov avatar Dec 14 '22 15:12 samandarkuchkarov

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...

dannyhw avatar Dec 14 '22 16:12 dannyhw

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 avatar Dec 15 '22 07:12 samandarkuchkarov

@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.

dannyhw avatar Dec 16 '22 10:12 dannyhw