Skip to content

Bootstrapping react app with scripts version 3.4.1 and typescript template broken #12573

@Anticom

Description

@Anticom

Describe the bug

Due to react-calendar not supporting React versions > 16, I'd like to be able to bootstrap a react app using an older scripts-version. However when running create-react-app with scripts-version 3.4.1 and typescript template, execution will fail with Error: Cannot find module 'cra-template-typescript'.

Did you try recovering your dependencies?

(not applicable)

Which terms did you search for in User Guide?

Both results where not helping.

Environment

$ npx create-react-app --info

Environment Info:

  current version of create-react-app: 5.0.1
  running from /Users/anticom/.npm/_npx/c67e74de0542c87c/node_modules/create-react-app

  System:
    OS: macOS 12.4
    CPU: (10) arm64 Apple M1 Pro
  Binaries:
    Node: 18.4.0 - /opt/homebrew/bin/node
    Yarn: 1.22.17 - /opt/homebrew/bin/yarn
    npm: 8.12.1 - /opt/homebrew/bin/npm
  Browsers:
    Chrome: 103.0.5060.53
    Edge: Not Found
    Firefox: 101.0
    Safari: 15.5
  npmPackages:
    react: Not Found
    react-dom: Not Found
    react-scripts: Not Found
  npmGlobalPackages:
    create-react-app: Not Found

Steps to reproduce

  1. npx create-react-app my-example-app --scripts-version 3.4.1 --template typescript

Expected behavior

I'd expect getting a React 16 app with typescript support bootstrapped for me.

Actual behavior

$ npx create-react-app my-example-app --scripts-version 3.4.1 --template typescript

Creating a new React app in /path/to/my-example-app.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template-typescript...


added 1621 packages in 2m

106 packages are looking for funding
  run `npm fund` for details
node:internal/modules/cjs/loader:949
  throw err;
  ^

Error: Cannot find module 'cra-template-typescript'
Require stack:
- /path/to/my-example-app/node_modules/react-scripts/scripts/init.js
- /path/to/my-example-app/[eval]
    at Module._resolveFilename (node:internal/modules/cjs/loader:946:15)
    at Function.resolve (node:internal/modules/cjs/helpers:108:19)
    at module.exports (/path/to/my-example-app/node_modules/react-scripts/scripts/init.js:110:13)
    at [eval]:3:14
    at Script.runInThisContext (node:vm:130:12)
    at Object.runInThisContext (node:vm:306:38)
    at node:internal/process/execution:76:19
    at [eval]-wrapper:6:22
    at evalScript (node:internal/process/execution:75:60)
    at node:internal/main/eval_string:27:3 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/path/to/my-example-app/node_modules/react-scripts/scripts/init.js',
    '/path/to/my-example-app/[eval]'
  ]
}

Node.js v18.4.0

Aborting installation.
  node  has failed.

Deleting generated file... node_modules
Deleting generated file... package.json
Done.

Reproducible demo

(see above)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions