Is there any way to create a react native project with - (dash) in project name?
Asked Answered
A

1

6

I am trying to create a react native project named 'work-mobile'. (- in project name) When I do npx react-native init work-mobile the cli give me error "work-mobile" is not a valid name for a project. Please use a valid identifier name (alphanumeric)..

I have tried first creating the project with _ (underscore) in name like 'work_mobile' and then using react-native-rename to rename the project but it also gives the same error like react-native-cli error.

I have tried manually doing that.

  • Renamed the folder name.
  • Renamed in package.json and app.json
  • Deleted iOS and android folders
  • Recreated using react native eject.

The iOS app starts working but for android now it doesn't connect to metro bundler. A blank screen appears on emulator. When I reload from metro, it say No apps connected I have tried starting bundler manually, reinstalling node mules, clearing cache, gradle cleaning etc things. enter image description here Any experience with that kind of thing?

Anecdotist answered 7/7, 2021 at 17:23 Comment(0)
B
-2

If you used "WorkMobile" as the name, react would automatically change that to work-mobile when it creates the project.

Belong answered 22/3, 2022 at 17:22 Comment(2)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Alboin
No, it doesn't. I just did that in react native and it named it exactly how I specified. No changes to a name with dashes occured.Misgive

© 2022 - 2024 — McMap. All rights reserved.