react-native-community / react-native-template-typescript

👾 Clean and minimalist React Native template for a quick start with TypeScript.
https://www.npmjs.com/package/react-native-template-typescript
MIT License
1.86k stars 398 forks source link

The install command tries to download wrong npm URL #177

Closed nth-chile closed 3 years ago

nth-chile commented 3 years ago

Expected results

For this command to succeed without errors:

npx react-native init MyApp --template react-native-template-typescript

Observed results

It tries to install react-native-template-react-native-template-typescript from the yarn package registry and errors

error An unexpected error occurred: "https://registry.yarnpkg.com/react-native-template-react-native-template-typescript: Not found".

Strangely, if I cd into the folder it creates and run the command again with a different name, I get no errors, see the ASCII React logo in terminal, and see a bunch of warnings that look like this:

warn Package react has been ignored because it contains invalid configuration. Reason: Cannot find module 'react/package.json'
Require stack:
...

but for six more packages

Logs

From yarn-error.log:

...

Yarn version: 
  1.22.5

Node version: 
  14.15.3

Platform: 
  darwin x64

  Error: https://registry.yarnpkg.com/react-native-template-react-native-template-typescript: Not found
      at Request.params.callback [as _callback] (/Users/jared/.yarn/lib/cli.js:66988:18)
      at Request.self.callback (/Users/jared/.yarn/lib/cli.js:140749:22)
      at Request.emit (events.js:209:13)
      at Request.<anonymous> (/Users/jared/.yarn/lib/cli.js:141721:10)
      at Request.emit (events.js:209:13)
      at IncomingMessage.<anonymous> (/Users/jared/.yarn/lib/cli.js:141643:12)
      at Object.onceWrapper (events.js:297:20)
      at IncomingMessage.emit (events.js:214:15)
      at endReadableNT (_stream_readable.js:1178:12)
      at processTicksAndRejections (internal/process/task_queues.js:77:11)

...

Steps to reproduce

  1. Not sure if this will happen for others, but on my computer just run the following command: npx react-native init MyApp --template react-native-template-typescript
emin93 commented 3 years ago

This is very likely because you are using the old deprecated React Native CLI. Please try following:

npm uninstall -g react-native-cli
yarn global remove react-native-cli
npx --ignore-existing react-native init MyApp --template react-native-template-typescript

Check here if you need further information: https://github.com/react-native-community/react-native-template-typescript/issues/80