Yacine
Yacine

Reputation: 743

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

Upvotes: 15

Views: 33993

Answers (5)

According to my experience with Centos 7, it must be executed as root

npx react-native init AwesomeTSProject --template react-native-template-typescript

in the location where the project needs to be created and then chown user -R folder, and in this way accepts the yarn add react-native- template-typescript without problems.

Upvotes: 0

Janaka Pushpakumara
Janaka Pushpakumara

Reputation: 5107

This will also help, --ignore-existing

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

Upvotes: 5

Carlos Stenzel
Carlos Stenzel

Reputation: 11

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] ...

Upvotes: 1

suther
suther

Reputation: 13578

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

Upvotes: 20

Yacine
Yacine

Reputation: 743

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

yarn remove global react-native-cli

Upvotes: 8

Related Questions