cli icon indicating copy to clipboard operation
cli copied to clipboard

npx react-native init AwesomeProject --version 0.57.3 doesnt work on ubuntu with nvm

Open anderskitson opened this issue 5 years ago • 4 comments

I have run the following npx react-native init AwesomeProject --version 0.57.3

and I get the following output

✔ Downloading template
✖ Copying template
error Error: Couldn't find the "/tmp/rncli-init-template-nSyXnK/node_modules/react-native/template.config.js file inside "react-native" template. Please make sure the template is valid. Read more: https://github.com/react-native-community/cli/blob/master/docs/init.md#creating-custom-template

Without the version number it runs fine. I have tried just 0.57, 0.58, and 0.59 with the same result. I never installed react native cli, just used npx. I am using nvm as my node version manager, and I am running node v12.18.0

Not sure how to solve this.

Thanks

anderskitson avatar Jun 13 '20 22:06 anderskitson

I have the same bug with npx react-native init App --template typescript command.

likern avatar Oct 29 '21 15:10 likern

npx will be pulling the latest version of the CLI, that's only compatible with RN ^0.65: https://github.com/react-native-community/cli#compatibility

You could try an npx react-native@^1.0.0 but that's only compatible with ^0.59so won't help with 0.57 or 0.58.

If you're starting a new project I wouldn't recommend using a version of RN that's over two years old but I'm guessing you have a good reason for needing the old one rather than a current one.

liamjones avatar Nov 01 '21 13:11 liamjones

@liamjones Without setting version, on newest RN and cli it still fails with the same error. See this comment https://github.com/react-native-community/react-native-template-typescript/issues/230#issuecomment-954873545

likern avatar Nov 01 '21 13:11 likern

@likern It's working fine here:

Screenshot 2021-11-01 at 13 56 35

Maybe take a look in the temp directory mentioned in your screenshot (if it still exists) and see if there's anything in there which might highlight why it's not working on your machine?

Maybe something to do with node version? My test which just worked was on 17.0.1 if that helps.

liamjones avatar Nov 01 '21 13:11 liamjones

There hasn't been any activity on this issue in the past 3 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days.

github-actions[bot] avatar Nov 27 '22 03:11 github-actions[bot]