Skip to content

Unable to run latest in all LTS node versions and unable to pin back #11772

Closed
@wesleytodd

Description

@wesleytodd

Describe the bug

There are two parts:

  1. Ability to run previous major versions of create-react-app to support node LTS (in this case v12 which was dropped in 5.x)
  2. The error message which implies it is a global install when it is not

For number one, the ecosystem relies on popular libraries supporting node LTS versions while they are still maintained. Dropping support 4 months early is tough. That said, if this was like a normal dependency which just allowed you to pin back it would not be an issue. Which leads me to my bug report that you cannot run 4.x to continue to running in node@12.

For number 2, it took us a bit to verify what was actually going on because the error message mentions "We no longer support global installation of Create React App.", which is a red herring here (see steps below which are not a global install but still trip the log).

Steps to reproduce

$ cd /tmp
$ npm install create-react-app@4.0.3
$ npx --no-install create-react-app my-app

You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0).

We no longer support global installation of Create React App.

Please remove any global installs with one of the following commands:
- npm uninstall -g create-react-app
- yarn global remove create-react-app

The latest instructions for creating a new app can

Expected behavior

That a user who explicitly installs and runs 4.x will still get the experience they expected out of that major version line.

Actual behavior

The latest check fails and the process exits.

Ideas for improving

The below command "works" if you manually patch the check here so that it does not log/exit.

create-react-app --scripts-version 4.0.3 my-app --template https://registry.npmjs.com/cra-template/-/cra-template-1.1.2.tgz

My thought was that if you added a --skip-latest-check which circumvented that semver comparison it would enable users to continue with the LTS until it's support actually expires.

Secondly, the logs could be updated to only print the message about a global install if it is actually a global install. The most reliable way to do this I know of is to compare to the node path path.dirname(process.execPath) === path.resolve(path.dirname(module.filename), '..') (or some other method to get the entry script, I think that is args._ from yargs maybe?)

If these ideas sound good we can probably open some PRs for them.


ASIDE: This is a breaking change in cra-template and should have been a major not a patch.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions