Hi There,
I’m trying to get started with Expo in combination with tools that I know from web. With that in mind I tried to install styled-components as I read there’s a react-native version of it available. After I installed styled-components and built a really simple styled View with it, the metro bundler is throwing an error.
Undefined is not an object (evaluating 'argv.indexOf')
When I remove the styled-components import at the top of the file, the error disappears.
Has anyone ever had this same issue?
P.S. The error only persists in a Blank expo project. When I let Expo scaffold a project with tabs already enabled, styled-components doesn’t throw any errors and works like a charm.
Thanks in advance,
Bram
please share a reproducible example. i suspect this might be something to do with node_modules, try deleting package-lock.json and node_modules and installing again with a blank project
You can reproduce this by creating a blank expo project. After that install styled-components. I literally didn’t do anything else.
I also did what you asked. I started a new blank project, copied the package.json to the new project and installed everything fresh. Unfortunately the same issue keeps popping up.
i was able to resolve it by running yarn add supports-color os
and then restarting expo-cli. this seems to be some issue with metro bundler (https://github.com/facebook/metro) and styled-components
2 Likes
Thanks for your help! Let’s close this topic.