Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

can not run `npx react-native init MyApp --template react-native-template-typescript` #80

Closed
Kennytian opened this issue Sep 28, 2019 · 22 comments

Comments

@Kennytian
Copy link
Contributor

@Kennytian Kennytian commented Sep 28, 2019

Bug

Environment info

React native info output:

 // paste it here

Library version: x.x.x

Steps To Reproduce

...

Describe what you expected to happen:

Reproducible sample code

yarn add v1.17.3
[1/4] 馃攳  Resolving packages...
warning jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > left-pad@1.3.0: use String.prototype.padStart()
error An unexpected error occurred: "https://registry.npmjs.org/react-native-template-react-native-template-typescript: Not found".
info If you think this is a bug, please open a bug report with the information provided in "/Users/kenny/react0611/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
yarn remove v1.17.3
[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:2599) UnhandledPromiseRejectionWarning: Error: Command failed: yarn add react-native-template-react-native-template-typescript
    at makeError (/Users/kenny/react0611/node_modules/execa/index.js:174:9)
    at Promise.all.then.arr (/Users/kenny/react0611/node_modules/execa/index.js:278:16)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:2599) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:2599) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
k
@KingAmo

This comment has been minimized.

Copy link

@KingAmo KingAmo commented Sep 28, 2019

same problem here

info Fetching template react-native-template-react-native-template-typescript...
yarn add v1.16.0
[1/4] 馃攳  Resolving packages...
warning jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > left-pad@1.3.0: use 
String.prototype.padStart()
error An unexpected error occurred: "https://registry.npmjs.org/react-native-template-react-
native-template-typescript: Not found".
info If you think this is a bug, please open a bug report with the information provided in 
"/Users/qinshuai/Documents/ReactNativeProj/RN_0.61/TsSimpleApp/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
yarn remove v1.16.0
[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.
@PeterKow

This comment has been minimized.

Copy link

@PeterKow PeterKow commented Sep 28, 2019

Just remember to npm uninstall -g react-native-cli and yarn global add @react-native-community/cli so you have new features during starting a new project

@radko93

This comment has been minimized.

Copy link
Collaborator

@radko93 radko93 commented Sep 28, 2019

@Kennytian @KingAmo seems like you are still using old CLI. Please try as @PeterKow suggeseted

@Kennytian

This comment has been minimized.

Copy link
Contributor Author

@Kennytian Kennytian commented Sep 29, 2019

@PeterKow @radko93 Thanks for your response, following is my operate steps

Step 1:

kenny@Kennys-Mac-mini ~ $ npm uninstall -g react-native-cli
up to date in 0.035s

Step 2:

kenny@Kennys-Mac-mini ~ $ yarn global add @react-native-community/cli
yarn global v1.17.3
[1/4] 馃攳  Resolving packages...
[2/4] 馃殮  Fetching packages...
[3/4] 馃敆  Linking dependencies...
warning "@react-native-community/cli > metro-react-native-babel-transformer@0.54.1" has unmet peer dependency "@babel/core@*".
warning " > @react-native-community/cli@2.9.0" has unmet peer dependency "react-native@^0.60.0".
[4/4] 馃敤  Building fresh packages...

warning Your current version of Yarn is out of date. The latest version is "1.19.0", while you're on "1.17.3".
info To upgrade, run the following command:
$ brew upgrade yarn
success Installed "@react-native-community/cli@2.9.0" with binaries:
      - react-native
鉁  Done in 8.83s.

Step 3:

npx react-native init MyApp --template react-native-template-typescript
This will walk you through creating a new React Native project in /Users/kenny/projects/private/reactnative/MyApp
Using yarn v1.17.3
Installing react-native...
yarn add v1.17.3
......
......
[1/4] 馃攳  Resolving packages...
error An unexpected error occurred: "https://registry.npmjs.org/react-native-template-react-native-template-typescript: Not found".
info If you think this is a bug, please open a bug report with the information provided in "/Users/kenny/projects/reactnative/react0611/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
yarn remove v1.17.3
[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:619) UnhandledPromiseRejectionWarning: Error: Command failed: yarn add react-native-template-react-native-template-typescript

The same issue here :(

@KingAmo

This comment has been minimized.

Copy link

@KingAmo KingAmo commented Sep 29, 2019

@Kennytian maybe you also need run yarn global remove react-native-cli

@Kennytian

This comment has been minimized.

Copy link
Contributor Author

@Kennytian Kennytian commented Sep 29, 2019

               ######                ######               
             ###     ####        ####     ###             
            ##          ###    ###          ##            
            ##             ####             ##            
            ##             ####             ##            
            ##           ##    ##           ##            
            ##         ###      ###         ##            
             ##  ########################  ##             
          ######    ###            ###    ######          
      ###     ##    ##              ##    ##     ###      
   ###         ## ###      ####      ### ##         ###   
  ##           ####      ########      ####           ##  
 ##             ###     ##########     ###             ## 
  ##           ####      ########      ####           ##  
   ###         ## ###      ####      ### ##         ###   
      ###     ##    ##              ##    ##     ###      
          ######    ###            ###    ######          
             ##  ########################  ##             
            ##         ###      ###         ##            
            ##           ##    ##           ##            
            ##             ####             ##            
            ##             ####             ##            
            ##          ###    ###          ##            
             ###     ####        ####     ###             
               ######                ######               
                                                          

                  Welcome to React Native!                
                 Learn Once Write Anywhere                

鉁 Downloading template
鉁 Copying template
error RangeError: Maximum call stack size exceeded

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

Show similar error

@radko93

This comment has been minimized.

Copy link
Collaborator

@radko93 radko93 commented Sep 29, 2019

@Kennytian what is Step 3?

@PeterKow

This comment has been minimized.

Copy link

@PeterKow PeterKow commented Sep 29, 2019

Confirm, I've run in the same issue in the end 鉁 Copying template error RangeError: Maximum call stack size exceeded

Then just end up installing RN and adding TS manually as in here -> https://facebook.github.io/react-native/docs/typescript

Sorry for late reply

@Kennytian

This comment has been minimized.

Copy link
Contributor Author

@Kennytian Kennytian commented Sep 29, 2019

@Kennytian what is Step 3?

@radko93

npx react-native init react0611 --template react-native-template-typescript

This will walk you through creating a new React Native project in /Users/kenny/projects/private/reactnative/react0611
Using yarn v1.17.3
Installing react-native...
yarn add v1.17.3

@MateusAndrade

This comment has been minimized.

Copy link
Member

@MateusAndrade MateusAndrade commented Sep 30, 2019

Just tested it here without any global package related to react-native cli on the global packages and it returns a similar error:

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.

Tested with: npx react-native init MyApp --template react-native-template-typescript and npx react-native init MyApp --template react-native-template-typescript@6.2.0

@emin93

This comment has been minimized.

Copy link
Collaborator

@emin93 emin93 commented Sep 30, 2019

The error message looks very much like it's coming from the old CLI because it's prepending react-native-template- to the package name.

I tried the following scenarios (macOS 10.14.6):

  • Global package @react-native-community/cli installed, no yarn installed
  • Global package @react-native-community/cli installed, yarn installed
  • No global CLI installed, yarn installed
  • No global CLI installed, no yarn installed

Everything seemed to work just fine, so I'm kind of running out of ideas.

@emin93

This comment has been minimized.

Copy link
Collaborator

@emin93 emin93 commented Sep 30, 2019

Can you try adding the --ignore-existing flag?

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

@Kennytian

This comment has been minimized.

Copy link
Contributor Author

@Kennytian Kennytian commented Sep 30, 2019

@emin93 Thanks for your reply, npx --ignore-existing react-native init MyApp --template react-native-template-typescript it's work.

Thanks all the same @KingAmo @PeterKow @radko93 @MateusAndrade !

@Kennytian Kennytian closed this Sep 30, 2019
@GreatAuk

This comment has been minimized.

Copy link

@GreatAuk GreatAuk commented Oct 9, 2019

Just remember to npm uninstall -g react-native-cli and yarn global add @react-native-community/cli so you have new features during starting a new project

I have a project with RN@0.58.6 and legacy react-native-cli锛 If I do this will affect my previous project ?

@radko93

This comment has been minimized.

Copy link
Collaborator

@radko93 radko93 commented Oct 9, 2019

@GreatAuk you can always install the old CLI again if anything bad happens. But I think it should be fine.

@GreatAuk

This comment has been minimized.

Copy link

@GreatAuk GreatAuk commented Oct 9, 2019

@GreatAuk you can always install the old CLI again if anything bad happens. But I think it should be fine.

npm install -g react-native-cli still download old CLI, not https://github.com/react-native-community/cli ?

@radko93

This comment has been minimized.

Copy link
Collaborator

@radko93 radko93 commented Oct 9, 2019

@GreatAuk yeah you can check on npm https://www.npmjs.com/package/react-native-cli

@tgmarinho

This comment has been minimized.

@Domino987

This comment has been minimized.

Copy link

@Domino987 Domino987 commented Dec 2, 2019

@emin93 npx --ignore-existing react-native init MyApp --template react-native-template-typescript does unfortunately not work for me. I uninstalled the react-native-cl and tried several different way to execute the npx call. Is there another way to get a new project set up with this?

@radko93

This comment has been minimized.

Copy link
Collaborator

@radko93 radko93 commented Dec 3, 2019

@Domino987 you are still somehow using the old CI if it fails. You can try installing new CLI globally but that's not recommended

@tsirolnik

This comment has been minimized.

Copy link

@tsirolnik tsirolnik commented Dec 15, 2019

Running the following command -

npx react-native init app --template react-native-template-typescript@6.2.0

Which is being introduced in the official React Native website here (substituted MyTSProject with app)

Results in the same output as above.

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 a bug report with the information provided in "/home/user/dev/App/mobile/app/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
yarn remove v1.13.0
[1/2] Removing module react-native-template-react-native-template-typescript@6.2.0...
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@6.2.0. This is not a critical error, you can work on your app.
(node:31167) UnhandledPromiseRejectionWarning: Error: Command failed: yarn add react-native-template-react-native-template-typescript@6.2.0
    at makeError (/home/user/dev/App/mobile/app/node_modules/execa/index.js:174:9)
    at Promise.all.then.arr (/home/user/dev/App/mobile/app/node_modules/execa/index.js:278:16)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:31167) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:31167) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@PeterKow 's answer solved this issue

@duongntb94

This comment has been minimized.

Copy link

@duongntb94 duongntb94 commented Jan 9, 2020

After I upgraded to yarn version 1.21.1, this problem has been resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can鈥檛 perform that action at this time.