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.

Initialising new RN 0.59 TypeScript project fails with yarn installed

See original GitHub issue

Expected results

What did you expect to happen?

A React Native 0.59 project with the TypeScript template applied.

Observed results

What happened?

During the installation process of the TypeScript template, one of the scripts fails which seems to break the setup process. After comparing the files created with and without the template, the package.json file in particular seems not to have been updated correctly but there could be other changes.

Logs

Please add the log output here.

info Setting up new React Native app in /Users/d/Projects/ExampleTestTS
info Fetching template react-native-template-typescript...
yarn add v1.13.0
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning " > react-native@0.59.0" has unmet peer dependency "react@16.8.3".
warning "react-native > @react-native-community/cli@1.4.0" has incorrect peer dependency "react-native@^0.57.0".
warning "react-native > metro-react-native-babel-transformer@0.51.0" has unmet peer dependency "@babel/core@*".
warning "react-native > @react-native-community/cli > metro-react-native-babel-transformer@0.51.1" has unmet peer dependency "@babel/core@*".
[4/4] 🔨  Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ react-native-template-typescript@5.0.0
info All dependencies
└─ react-native-template-typescript@5.0.0
✨  Done in 8.71s.
info Adding dependencies for the project...
info No additional dependencies.
info Adding develop dependencies for the project...
yarn add v1.13.0
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning " > react-native@0.59.0" has unmet peer dependency "react@16.8.3".
warning "react-native > @react-native-community/cli@1.4.0" has incorrect peer dependency "react-native@^0.57.0".
warning "react-native > metro-react-native-babel-transformer@0.51.0" has unmet peer dependency "@babel/core@*".
warning "react-native > @react-native-community/cli > metro-react-native-babel-transformer@0.51.1" has unmet peer dependency "@babel/core@*".
[4/4] 🔨  Building fresh packages...
error /Users/drew/Projects/ExampleTestTS/node_modules/react-native-template-typescript: Command failed.
Exit code: 1
Command: node setup.js
Arguments:
Directory: /Users/drew/Projects/ExampleTestTS/node_modules/react-native-template-typescript
Output:
fs.js:119
    throw err;
    ^

Error: ENOENT: no such file or directory, unlink '/Users/d/Projects/ExampleTestTS/.flowconfig'
    at Object.unlinkSync (fs.js:972:3)
    at deleteProjectFile (/Users/d/Projects/ExampleTestTS/node_modules/react-native-template-typescript/setup.js:13:42)
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/Users/d/Projects/ExampleTestTS/node_modules/react-native-template-typescript/setup.js:16:22)
    at Module._compile (internal/modules/cjs/loader.js:799:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:810:10)
    at Module.load (internal/modules/cjs/loader.js:666:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:606:12)
    at Function.Module._load (internal/modules/cjs/loader.js:598:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:862:12)
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-typescript...
[2/2] 🔨  Regenerating lockfile and installing missing dependencies...
warning " > react-native@0.59.0" has unmet peer dependency "react@16.8.3".
warning "react-native > @react-native-community/cli@1.4.0" has incorrect peer dependency "react-native@^0.57.0".
warning "react-native > metro-react-native-babel-transformer@0.51.0" has unmet peer dependency "@babel/core@*".
warning "react-native > @react-native-community/cli > metro-react-native-babel-transformer@0.51.1" has unmet peer dependency "@babel/core@*".
success Uninstalled packages.
✨  Done in 9.32s.
child_process.js:677
    throw err;
    ^

Error: Command failed: yarn add -D @types/jest@latest @types/react-native@latest @types/react-test-renderer@latest @types/react@latest typescript@latest
    at checkExecSyncError (child_process.js:637:11)
    at execSync (child_process.js:674:13)
    at PackageManager.executeCommand (/Users/d/Projects/ExampleTestTS/node_modules/@react-native-community/cli/build/tools/PackageManager.js:28:42)
    at PackageManager.installDev (/Users/d/Projects/ExampleTestTS/node_modules/@react-native-community/cli/build/tools/PackageManager.js:42:41)
    at installTemplateDevDependencies (/Users/d/Projects/ExampleTestTS/node_modules/@react-native-community/cli/build/tools/generator/templates.js:194:6)
    at createFromRemoteTemplate (/Users/d/Projects/ExampleTestTS/node_modules/@react-native-community/cli/build/tools/generator/templates.js:124:5)
    at createProjectFromTemplate (/Users/d/Projects/ExampleTestTS/node_modules/@react-native-community/cli/build/tools/generator/templates.js:81:3)
    at generateProject (/Users/d/Projects/ExampleTestTS/node_modules/@react-native-community/cli/build/commands/init/init.js:109:44)
    at Object.init (/Users/d/Projects/ExampleTestTS/node_modules/@react-native-community/cli/build/commands/init/init.js:92:3)
    at run (/Users/drew/.nvm/versions/node/v11.11.0/lib/node_modules/react-native-cli/index.js:302:7)

Steps to reproduce

  1. Install yarn globally.

  2. Create a new repository with react-native init Example --template typescript


This is more of a heads up than a help request as I prefer to use npm over yarn, but I did happen to have yarn installed so it did cause me a few headscratches this afternoon when the new template dropped. I solved it by uninstalling yarn (yay!), but thought I should let you know in case anyone else comes across the same problem.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:8

github_iconTop GitHub Comments

1reaction
poppiestarcommented, Mar 12, 2019

Oh, and thank you many times over for this template - it’s ace and all your hard work is massively appreciated!

0reactions
zeevlcommented, Mar 12, 2019

Thanks for the quick work on this @emin93!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Initialising new RN 0.59 TypeScript project fails with yarn ...
What happened? During the installation process of the TypeScript template, one of the scripts fails which seems to break the setup process.
Read more >
react-native-typescript-transformer | Yarn - Package Manager
If you are starting a new React Native project, you can initialize the project with this command: react-native init MyAwesomeProject --template typescript.
Read more >
Why yarn install gives typescript error from dependency after ...
I cleaned my react native project with react-native-clean-project. After that yarn install gives this error: warning ../../../../../.
Read more >
Using TypeScript with React Native
My favourite is TypeScript, but React Native supports Flow out of the box. ... to your project; initialize an empty TypeScript config file, ......
Read more >
@vforvasile/react-native-merryjs-photo-viewer - npm
Fork from original merryjs repo with quick fix that caused failed builds in RN 0.59+. Latest version: 1.0.2, last published: 4 years ago....
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