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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating new app with typescript template giving an error on yarn start #8716

Closed
ericdsw opened this issue Mar 25, 2020 · 10 comments
Closed

Comments

@ericdsw
Copy link

ericdsw commented Mar 25, 2020

Describe the bug

I was trying to create a new react app using typescript, but I ran into an issue when trying to run it. I ran the npx create-react-app just_testing --template typescript and everything installed correctly, but when I ran yarn start to test it I got the following error:

TypeScript error in /Users/ericdesedas/Development/projects/javascript/just_testing_2/node_modules/@types/testing-library__react/node_modules/pretty-format/build/index.d.ts(7,13):
'=' expected.  TS1005

     5 |  * LICENSE file in the root directory of this source tree.
     6 |  */
  >  7 | import type * as PrettyFormat from './types';
       |             ^
     8 | /**
     9 |  * Returns a presentation string of your `val` object
    10 |  * @param val any potential JavaScript object

Did you try recovering your dependencies?

yarn version: 1.22.4
npm version: 6.13.7

Environment

This is what I get when I run npx create-react-app --info:

Environment Info:

  current version of create-react-app: 3.4.1
  running from /Users/ericdesedas/.config/yarn/global/node_modules/create-react-app

  System:
    OS: macOS 10.15.3
    CPU: (4) x64 Intel(R) Core(TM) i5-6360U CPU @ 2.00GHz
  Binaries:
    Node: 13.9.0 - ~/.nvm/versions/node/v13.9.0/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.13.7 - ~/.nvm/versions/node/v13.9.0/bin/npm
  Browsers:
    Chrome: 80.0.3987.149
    Firefox: Not Found
    Safari: 13.0.5
  npmPackages:
    react: ^16.13.1 => 16.13.1
    react-dom: ^16.13.1 => 16.13.1
    react-scripts: 3.4.1 => 3.4.1
  npmGlobalPackages:
    create-react-app: Not Found

Steps to reproduce

It appears that creating a new react app with typescript is installing a dependency with some kind of release error.

  1. Run npx create-react-app my_app --template typescript
  2. Wait for the installation to finish
  3. Run yarn start and watch the error in PrettyFormat.

Note: I also tried to run yarn create react-app just_testing --typescript`, but the error kept showing up.

Expected behavior

I assumed that a brand new react app should be able to run without issue.

Actual behavior

The only output I got is what I showed as the error in a previous section, both in the terminal and in the browser.

Reproducible demo

N/A

@alexandreramosdev
Copy link

alexandreramosdev commented Mar 25, 2020

I have the same problem

@existentialism
Copy link
Contributor

existentialism commented Mar 26, 2020

It's due to pretty-format@25.2.0 (part of jest) relying on TS 3.8 syntax.

Ref: #8714, #8717, and #8713

@SarthakThakur0097
Copy link

So are there any fixes for it currently or do we have to wait for the FB team to fix this?

@zunsakai
Copy link

same problem ...

@programateus
Copy link

After creating the application, just update typedcript with npm update typescript

@luiza177
Copy link

I had the same problem with npm start. Will try mateusbds' solution.

@ericdsw
Copy link
Author

ericdsw commented Mar 30, 2020

Yeah, running yarn upgrade --latest seems to fix the problem as well.

@luiza177
Copy link

Can also confirm runningnpm update typescript fixes the problem.

@stale
Copy link

stale bot commented May 1, 2020

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

@stale stale bot added the stale label May 1, 2020
@stale
Copy link

stale bot commented May 6, 2020

This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue.

@stale stale bot closed this as completed May 6, 2020
@lock lock bot locked and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants
@existentialism @ericdsw @zunsakai @programateus @alexandreramosdev @luiza177 @SarthakThakur0097 and others