Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

After uninstalling the react-native-cli i run this command to initiate a RN project with typescript template:

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

but i got this error:

warning jest > jest-cli > jest-config > jest-environment-jsdom > jsdom

[email protected]: use String.prototype.padStart() error An unexpected error occurred: "https://registry.yarnpkg.com/react-native-template-react-native-template-typescript: Not found".info If you think this is a bug, please open .....
[1/2] Removing module react-native-template-react-native-template-typescript...
error This module isn't specified in a package.json file.
info Visit https://yarnpkg.com/en/docs/cli/remove for documentation about this command. warn Failed to clean up template temp files in node_modules/react-native-template-react-native-template-typescript. This is not a critical error, you can work on your app.
(node:8548) UnhandledPromiseRejectionWarning: Error: Command failed: yarn add react-native-template-react-native-template-typescript

like image 742
Yacine Avatar asked Sep 24 '19 10:09

Yacine


4 Answers

Remove the legacy react-native-cli

npm uninstall -g react-native-cli

Install new one from "react-native-community":

npm i -g @react-native-community/cli

after that, init the Project with:

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

like image 94
suther Avatar answered Nov 14 '22 12:11

suther


Resolved: i had to remove react native cli using yarn too

yarn remove global react-native-cli

like image 8
Yacine Avatar answered Nov 14 '22 10:11

Yacine


This will also help, --ignore-existing

npx --ignore-existing react-native init MyApp --template react-native-template-typescript
like image 5
Janaka Pushpakumara Avatar answered Nov 14 '22 10:11

Janaka Pushpakumara


Best solution I found

Remove

npm uninstall -g react-native-cli

Create the folder where the project will be

mkdir [folder name] && cd [folder name]

Install the dependencies and everything will work

yarn init
yarn add react-native
yarn react-native init [Project Name] ...
like image 1
Carlos Stenzel Avatar answered Nov 14 '22 12:11

Carlos Stenzel