I want to create new app but upon running init I’m facing issue on first step – Resolving packages.
Command:
npx react-native init doggo --verbose
Error:
debug Installing template from react-native@latest
yarn init v1.22.19
warning The yes flag has been set. This will automatically answer yes to all questions, which may have security implications.
success Saved package.json
✨ Done in 0.03s.
yarn config v1.22.19
success Set "nodeLinker" to "node-modules".
✨ Done in 0.03s.
yarn add v1.22.19
info No lockfile found.
[1/4] 🔍 Resolving packages...
error Couldn't find package "react-native" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
error Installing pods failed. This doesn't affect project initialization and you can safely proceed.
However, you will need to install pods manually when running iOS, follow additional steps in "Run instructions for iOS" section.
As you can see, error says that react-native package doesn’t exist but it is in fact
filip@MacBook-Pro-Filip-2 IdeaProjects % npm config get registry
https://registry.npmjs.org/
filip@MacBook-Pro-Filip-2 IdeaProjects % yarn config get registry
https://registry.yarnpkg.com
filip@MacBook-Pro-Filip-2 IdeaProjects % npx react-native -v
12.3.6
2
Answers
I’m noticing that your react-native version is:
12.3.6
However, on the npm registry, the latest version is:
0.73.6
Pulled this from the react native documentation:
If you still have the old CLI installed try running:
as it may cause unexpected issues.
Then try running
If the issue still persists, I would specify the react-native version
With
npx react-native <command>
, the version of the CLI will be downloaded and executed at the time the command is run.if you install react-native >= 73 make sure you use node-v >= 18
and try again
npx react-native@latest init doggoapp