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.

create-react-app with --typescript doesn't work when installed globally - update docs accordingly

See original GitHub issue

Is this a bug report?

No - documentation issue.

Did you try recovering your dependencies?

No. Not the issue.

Not relevant. (Write your answer here.)

Which terms did you search for in User Guide?

The user guide is incorrect, by your own statement here: https://github.com/facebook/create-react-app/issues/6319#issuecomment-459627529 - unfortunately, this wasn’t ever corrected, and I believe the behavior is still actually broken, aside from the docs not being updated.

Not relevant. (Write your answer here if relevant.)

Environment

Not relevant.

Steps to Reproduce

(Write your steps here:)

Expected Behavior

(Write what you thought would happen.)

Actual Behavior

(Write what happened. Please add screenshots!)

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

TL; DR:

This was closed: https://github.com/facebook/create-react-app/issues/6319

This was the answer given: https://github.com/facebook/create-react-app/issues/6319#issuecomment-459627529 - which works, but doesn’t match what the docs say (despite the answer explicitly stating so).

This is still wrong: https://facebook.github.io/create-react-app/docs/adding-typescript

I’d be happy to submit a pull request to update the documentation to provide a warning about this, but as it stands you’re likely to keep getting bug reports about it.

I’ve found at least 3 of them myself.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
iansucommented, Apr 24, 2019

That sounds reasonable. Please send a PR for the docs.

1reaction
methodboxcommented, Apr 23, 2019

There’s isn’t a need to explicitly install CRA globally anymore with npx available. Using npx ensure you always use the latest version of our CLI w whenever you are bootstrapping a new app.

While I appreciate that, as you can see that wasn’t my first move; I took the “old school” approach and relied on the fact that I already had it installed globally, looked up the flag for installing using TS and it didn’t work.

I went and found a GitHub issue that described the issue I was having, and here we are. I never looked at your home page in the docs because I wasn’t pointed there and my Google search didn’t return that result, it returned the GH issue. (I’m saying this as an example of how user interaction would commonly go, not as a complaint).

When viewing the GitHub page I’m suggesting to update, there was no indication that having CRA installed globally would cause the issue I am seeing.

It might be worth updating the docs, specifically that page as well, to indicate what you just said. It’s not clear that having it installed globally would cause a conflict.

You have this on the Getting Started page, I’m simply suggesting to add it to the TS page, as well, maybe with a note about possible conflict:

If you’ve previously installed create-react-app globally via npm install -g create-react-app, we recommend you uninstall the package using npm uninstall -g create-react-app to ensure that npx always uses the latest version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

create-react-app is not working since version 4.0.1
So to fix the error you're getting, uninstall create-react-app globally, update npm, clear the cache, and retry creating the app. Run this in ......
Read more >
Adding TypeScript - Create React App
If you've previously installed create-react-app globally via npm install -g create-react-app , we recommend you uninstall the package using ...
Read more >
Create a New React App
Create React App doesn't handle backend logic or databases; it just creates a frontend build pipeline, so you can use it with any...
Read more >
How to use TypeScript with React: A tutorial with examples
TypeScript is a free, open source programming language developed and ... To install TypeScript with create-react-app , run the following ...
Read more >
How to Install React.js with create-react-app - freeCodeCamp
As a Frontend Developer, I have personally worked with React in my projects and probably will continue to work with it in the...
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