So I am completely new to expo and am trying to use it to create react native apps. I just installed it a couple days ago so it should be the newest version and tried creating a very simple app while following a tutorial, and after dealing with a bunch of errors getting expo to install and create a project properly, I am now getting the following error when running yarn start:
error: unknown option `–assetPlugins’
Metro Bundler process exited with code 1
I’ve already searched for other resolutions to this error to no avail, does anyone have any idea what could be going wrong? I’ve tried deleting node modules and deleting the package-lock.json like someone suggested on stackoverflow but nothing works.
See my stackoverflow question here: javascript - Error running React Native app - unknown option - Stack Overflow
Thanks in advance!
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ │
│ There is a new version of expo-cli available (3.11.2). │
│ You are currently using expo-cli 3.11.0 │
│ Install expo-cli globally using the package manager of your choice; for example: `npm install -g expo-cli` to get the latest version │
│ │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Expo CLI 3.11.0 environment info:
System:
OS: Windows 10
Binaries:
Yarn: 1.21.0 - C:\Users\Alex\AppData\Roaming\npm\yarn.CMD
npm: 6.12.1 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.5.0.0 AI-191.8026.42.35.6010548
So i updated expo, but then when i run yarn start I am still seeing this error:
error: unknown option `--assetPlugins'
Metro Bundler process exited with code 1
npm install --global ... and npm install -g ... and npm i -g ... are all the same.
Unfortunately it seems that things have been a bit unstable on Windows recently because of a combination a of node 13.x issue and a dependency of Expo not having precompiled binaries for node 13.
Also, the warnings you get when installing expo-cli (on all platforms) just obscure any problems if there are any. This is a known problem, but not easy to solve apparently.
For installing expo-cli using npm should be fine, but I see you’re using yarn to install the dependencies in your project. That’s also perfectly fine. But you should not mix the two when installing dependencies.
npm install inside your project without the -g or --global options would install your dependencies as specified in package.json and create a package-lock.json file.
yarn would install your dependencies and create a yarn.lock file.
You should never have both of these lock files. Since you’re using yarn to install your dependencies and to start the dev server/bundler you should make sure you delete package-lock.json and never run npm without the -g or --global options inside your project.
If you do currently have a package-lock.json file, delete it and node_modules again and run yarn.
Then try the following before trying expo start.
(yarn start actually just runs expo start anyway as specified in your package.json’s “scripts” section.)
Run watchman watch-del-all
Delete anything in your temp directory called react-*
Delete the .expo directory within your project. It will be recreated when you run expo start (or expo start -c)
Run expo start -c
I hope that sorts it out.
By the way, is this an app you have done any work on yet, or did you not get further than expo init? If the latter then you can also try creating a new project with expo init and paste the whole output here if it still gives you problems.
Hi so I deleted the expo folder and node modules. But when I tried running watchman watch-del-all cli says it is not a recognized command. So I ran yarn and then I tried expo start -c but then when my program launched in the browser I got the following massive cli error:
error Invalid regular expression: /(.*\\__fixtures__\\.*|node_modules[\\\]react[\\\]dist[\\\].*|website\\node_modules\\.*|heapCapture\\bundle\.js|.*\\__tests__\\.*)$/: Unterminated character class. Run CLI with --verbose flag for more details.
SyntaxError: Invalid regular expression: /(.*\\__fixtures__\\.*|node_modules[\\\]react[\\\]dist[\\\].*|website\\node_modules\\.*|heapCapture\\bundle\.js|.*\\__tests__\\.*)$/: Unterminated character class
at new RegExp (<anonymous>)
at blacklist (C:\www\first\node_modules\metro-config\src\defaults\blacklist.js:34:10)
at getBlacklistRE (C:\www\first\node_modules\@react-native-community\cli\build\tools\loadMetroConfig.js:66:59)
at getDefaultConfig (C:\www\first\node_modules\@react-native-community\cli\build\tools\loadMetroConfig.js:82:20)
at load (C:\www\first\node_modules\@react-native-community\cli\build\tools\loadMetroConfig.js:118:25)
at Object.runServer [as func] (C:\www\first\node_modules\@react-native-community\cli\build\commands\server\runServer.js:82:58)
at Command.handleAction (C:\www\first\node_modules\@react-native-community\cli\build\index.js:164:23)
at Command.listener (C:\www\first\node_modules\commander\index.js:315:8)
at Command.emit (events.js:210:5)
at Command.parseArgs (C:\www\first\node_modules\commander\index.js:651:12)
Metro Bundler process exited with code 1
Set EXPO_DEBUG=true in your env to view the stack trace.
So I’ll try recreating the project from scratch sometime soon when I have more time to code, I’ve been very busy with family functions over the past week. The program is very simple and so I’ll try recreating it and then just use either npm or yarn for installing dependencies. Is there one that is better than the other?
When I try that at first it loaded in Edge and had a couple options to choose from on the side of the page such as run in an emulator, but then a few seconds later the screen went all black in the browser and I saw this error in cmd:
error Invalid regular expression: /(.*\\__fixtures__\\.*|node_modules[\\\]react[\\\]dist[\\\].*|website\\node_modules\\.*|heapCapture\\bundle\.js|.*\\__tests__\\.*)$/: Unterminated character class. Run CLI with --verbose flag for more details.
There’s something weird going on (maybe with the PATH environment variable, so could you please double check some things?
In the same directory where you are running expo start (i.e. in the newly created app where you got the latest error), please run node --version and paste the output here. Please also re-run expo diagnostics which should print more info than it did in your earlier comment when run from the app directory.
C:\test>expo diagnostics
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ │
│ There is a new version of expo-cli available (3.11.3). │
│ You are currently using expo-cli 3.11.2 │
│ Install expo-cli globally using the package manager of your choice; for example: npm install -g expo-cli to get the latest version │
│ │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
And C:\test contains files called app.json, package.json, yarn.lockorpackage-lock.json (but not both lock files), App.js and a directory called node_modules containing a lot of JavaScript libraries?
It should work, even though it seems to me that things are more likely to break on Windows than on macOS or Linux. But since it’s not working you you, try one or more of the following things that should also work (but given the strange situation on your machine, I can’t say for sure):
Try running everything in PowerShell instead of cmd.exe.
If that doesn’t work, installing WSL and Ubuntu within Windows 10 and then installing node and expo-cli on Ubuntu and running everything from there should also work, and might even be less hassle in the long run.
When trying to run expo init in powershell I got this error:
expo : File C:\Users\Alex\AppData\Roaming\npm\expo.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see
about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ expo init test
+ ~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
I thought this error was caused by running cmd/powershell normally and not in admin mode but I am running it in administrative mode. Any idea whats going on with that? I’ll try your other suggestion soon when I have more time.
If neither work I may look into getting a new computer, I’ve had issues with my computer in the past so it may be time to do that, I really want to learn app development
Reading that Microsoft link it seems that PowerShell script execution disabled on your machine.
If I understand it correctly you can enable the scripts as follows:
Close the Admin PowerShell window and open a normal, non-Admin PowerShell window.
Try running expo init etc.
It does seem like there’s a possibility of something being misconfigured on your machine, but before you buy a new one, maybe try reinstalling/refreshing Windows.
So i did that and then tried expo init test but then when it ran it got stuck here for over 20 minutes:
─────────────────┘
? Choose a template: expo-template-blank
√ Please enter a few initial configuration values.
Read more: https://docs.expo.io/versions/latest/workflow/configuration/ · 100% completed
? Yarn v1.21.0 found. Use Yarn to install dependencies? Yes
Extracting project files...
Customizing project...
Unable to initialize git repo. `git` not in PATH.
Installing dependencies...
yarn install v1.21.0
warning ..\package.json: No license field
info No lockfile found.
[1/4] Resolving packages...
warning expo > fbemitter > fbjs > core-js@1.2.7: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > fbjs > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > fbjs-scripts > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native > metro-babel-register > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning react-native-web > deep-assign@3.0.0: Check out `lodash.merge` or `merge-options` instead.
[2/4] Fetching packages...
info fsevents@1.2.11: The platform "win32" is incompatible with this module.
info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[####################--------------------------------------------------------------------------------------] 4466/23900
so I gave up on it. So now I’ll try your suggestion of running expo-cli on Ubuntu. I’m just waiting for windows to switch to developer mode for that. Will this completely change my operating system? How does this work?
Btw I’m following this link from the link you sent me:
It looks like the PowerShell option was working… except for it taking so long :-/
WSL will not change your operating system. It just installs Ubuntu inside Windows. It’s a bit like running it in a virtual machine. So you can run Linux commands (e.g. the Linux version of node, etc.) within WSL, but the rest of your system will be exactly as it was.
Well my computer actually crashed last night randomly while gaming, so I may be buying a new computer soon. I’ve had multiple issues with my computer over the years, when I brought it into a repair shop a guy that works there said he’s repaired multiple Acer laptops exact same as mine for motherboard issues over the past couple years so I think I’m going to look for a new computer. So I think I’ll put off trying that option until I get a new computer, hopefully with a new setup I can just run Expo like normal. Thanks again for your help with my issues, I’ll update you here when I decide what I’m going to do