Skip to content

Initialising new RN 0.59 TypeScript project fails with yarn installed #32

@poppiestar

Description

@poppiestar

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions