question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UnhandledPromiseRejectionWarning: Error: Command failed: yarn add react-native-template-react-native-template-typescript

See original GitHub issue

ref https://github.com/facebook/react-native/issues/29411

Description

I am trying to start a new project with typescript template and it’s failing on the step Removing module react-native-template-react-native-template-typescript... with error error This module isn't specified in a package.json file., followed by this error UnhandledPromiseRejectionWarning: Error: Command failed: yarn add react-native-template-react-native-template-typescript.

This is the command I am running: npx react-native init MyAwesomeApp --template react-native-template-typescript

React Native version:

0.63

Steps To Reproduce

  1. run npx react-native init MyAwesomeApp --template react-native-template-typescript
  2. watch it fails

Expected Results

Successfully creates a new RN project

Snack, code example, screenshot, or link to a repository:

Full stack trace:

[1/4] 🔍  Resolving packages...
warning jest > @jest/core > jest-config > jest-environment-jsdom > jsdom > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
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 "/path/to/project/MyAwesomeApp/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
yarn remove v1.22.4
[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:68507) UnhandledPromiseRejectionWarning: Error: Command failed: yarn add react-native-template-react-native-template-typescript
    at makeError (/path/to/project/MyAwesomeApp/node_modules/execa/index.js:174:9)
    at /path/to/project/MyAwesomeApp/node_modules/execa/index.js:278:16
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async createFromRemoteTemplate (/path/to/project/MyAwesomeApp/node_modules/@react-native-community/cli/build/tools/generator/templates.js:115:5)
    at async createProjectFromTemplate (/path/to/project/MyAwesomeApp/node_modules/@react-native-community/cli/build/tools/generator/templates.js:88:3)
    at async generateProject (/path/to/project/MyAwesomeApp/node_modules/@react-native-community/cli/build/commands/init/initCompat.js:118:3)
    at async Object.initCompat (/path/to/project/MyAwesomeApp/node_modules/@react-native-community/cli/build/commands/init/initCompat.js:105:3)
(node:68507) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
(node:68507) [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.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
thymikeecommented, Dec 10, 2020

You may have installed it by accident. Try npx react-native@0.63 init or npx @react-native-community/cli init which will also work.

1reaction
thymikeecommented, Dec 10, 2020

@jgcmarins @DevHabit it’s apparent you have a globale react-native binary installed, (react-native-cli module), which you should remove. Please make sure to run npm uninstall -g remove react-native react-native-cli and same for Yarn. Check some older Node versions or caches. Running which react-native shouldn’t return anything. Then you can run:

npx react-native init MyAwesomeApp --template react-native-template-typescript

as official RN docs advise: https://reactnative.dev/docs/typescript

Read more comments on GitHub >

github_iconTop Results From Across the Web

UnhandledPromiseRejectionWar...
UnhandledPromiseRejectionWarning: Error: Command failed: yarn add react-native-template-react-native-template-typescript #29411.
Read more >
Error: Command failed: yarn add react-native@latest
I've been trying to start a new React Native project but have been facing this issue for a few days, tried searching for...
Read more >
Error Codes | Yarn - Package Manager
This error means that this process failed and Yarn cannot successfully figure out which version of the package should be added to your...
Read more >
Strange build error with yarn add - beginner - ReScript Forum
❯ yarn build yarn run v1.22.19 $ rescript /bin/sh: rescript: command not found error Command failed with exit code 127. info Visit https://yarnpkg.com/en/docs/ ......
Read more >
141.0 yarn broke node.js deployment [35907771] - Issue Tracker
(node:22046) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Command failed with exit code 1
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found