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

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

Closed
methodbox opened this issue Apr 13, 2019 · 10 comments

Comments

@methodbox
Copy link
Contributor

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: #6319 (comment) - 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: #6319

This was the answer given: #6319 (comment) - 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.

@ianschmitz
Copy link
Contributor

Can you double check that you're following the docs that you linked exactly?

As mentioned in the issue you linked make sure you don't have create-react-app installed globally before running the command.

@methodbox
Copy link
Contributor Author

@ianschmitz

Sorry meant to edit that - part got copied from another issue.

This is only a request to update the docs. Which are still wrong.

@ianschmitz
Copy link
Contributor

Can you clarify what is incorrect about the docs? I'm not following.

@thakuranujsingh
Copy link

thakuranujsingh commented Apr 22, 2019

I am trying to install create-react-app my-app --scripts-version=react-scripts-ts and install the node-sass package, but my scss styling is not working, could you please help to solve the issue

@bugzpodder
Copy link

React-scripts-ts is deprecated. Use the --typescript option

@methodbox
Copy link
Contributor Author

@ianschmitz

Yes, the previous issue suggested that the docs indicate to remove CRA globally (or that you cannot have it installed globally) and use the —typescript flag to create a CRA TS project.

This is correct, however it is not reflected in the docs, and is, IMHO unexpected behavior.

In order to get this to operate correctly I couldn’t just install CRA locally, I had to remove it globally first.

If you’re using TS on every project, as you probably are unless you’re just starting out, it would seem you should be able to install globally and still use this flag, else have to reinstall every time. If you’re not, for some reason always using TS, then you can’t ever install globally for use with just JS, either.

Regardless, there’s no caveat in the docs that I could find indicating that this was an issue. That should be updated, especially with the prevalence of TS these days.

@ianschmitz
Copy link
Contributor

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.

@methodbox
Copy link
Contributor Author

methodbox commented 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.

@methodbox methodbox changed the title create-react-app with --typescript doesn't work (and the docs still aren't right) create-react-app with --typescript doesn't work when installed globally - update docs accordingly Apr 23, 2019
@iansu
Copy link
Contributor

iansu commented Apr 24, 2019

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

@amyrlam
Copy link
Contributor

amyrlam commented May 1, 2019

Closed by #6945.

@amyrlam amyrlam closed this as completed May 1, 2019
@lock lock bot locked and limited conversation to collaborators May 6, 2019
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

6 participants