When you need to install some dependence in your project you can use:
npx --ignore-existing ....
It allows you to get the new version from npm package without look for your node_modules/bin that was installed in your operational system.
I had issues with that when I attempt to install React Native with Typescript!
npm uninstall -g react-native-cli
yarn global add @react-native-community/cli
And nothing worked for me, then I saw this answer: https://github.com/react-native-community/react-native-template-typescript/issues/80#issuecomment-536419979
So, I googled about
and I got this:
--ignore-existing - If this flag is set, npx will not look in $PATH , or in the current package's node_modules/.bin for an existing version before deciding whether to install. Binaries in those paths will still be available for execution, but will be shadowed by any packages requested by this install.
Then, I tried:
npx --ignore-existing react-native init MyApp --template react-native-template-typescript
And it works \o/! But it spends more time because it grabs all content on the Internet, doesn't look for your cache files.
Now your project React Native will be installed without a problem, you can run:
cd MyApp && yarn ios
cd MyApp && yarn android
For install in the ios simulator or android emulator.