Skip to content

Custom react-scripts error: Cannot find module 'cra-template-typescript' #7984

@revmischa

Description

@revmischa

Describe the bug

I've been maintaining a fork of CRA for quickly setting up new projects with our project template. Everything was working fine and previously I was able to initialize new projects with create-react-app myapp --typescript --scripts-version jetbridge-react-scripts --use-npm
However now after updating to the latest version from master and moving my files into packages/cra-template-typescript and publishing our fork of react-scripts to npm, I get the following error when attempting to initialize a new project:

❯ npx create-react-app t --template typescript --use-npm --scripts-version jetbridge-react-scripts

Creating a new React app in /Users/cyber/dev/jb/jbcra/t.

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


> fsevents@1.2.9 install /Users/cyber/dev/jb/jbcra/t/node_modules/chokidar/node_modules/fsevents
> node install

[fsevents] Success: "/Users/cyber/dev/jb/jbcra/t/node_modules/chokidar/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" is installed via remote

> fsevents@1.2.9 install /Users/cyber/dev/jb/jbcra/t/node_modules/jest-haste-map/node_modules/fsevents
> node install

[fsevents] Success: "/Users/cyber/dev/jb/jbcra/t/node_modules/jest-haste-map/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" is installed via remote

> core-js@2.6.10 postinstall /Users/cyber/dev/jb/jbcra/t/node_modules/babel-runtime/node_modules/core-js
> node postinstall || echo "ignore"


> core-js@3.2.1 postinstall /Users/cyber/dev/jb/jbcra/t/node_modules/core-js
> node scripts/postinstall || echo "ignore"

+ cra-template-typescript@0.1.0
+ jetbridge-react-scripts@1.1.3
+ react@16.12.0
+ react-dom@16.12.0
added 1652 packages from 713 contributors and audited 904869 packages in 47.823s
found 0 vulnerabilities

internal/modules/cjs/loader.js:583
    throw err;
    ^

Error: Cannot find module 'cra-template-typescript'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.resolve (internal/modules/cjs/helpers.js:32:19)
    at module.exports (/Users/cyber/dev/jb/jbcra/t/node_modules/jetbridge-react-scripts/scripts/init.js:110:13)
    at [eval]:3:14
    at Script.runInThisContext (vm.js:96:20)
    at Object.runInThisContext (vm.js:303:38)
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at evalScript (internal/bootstrap/node.js:586:27)
    at startup (internal/bootstrap/node.js:264:9)

Aborting installation.
  node  has failed.

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

How do I publish/use my custom cra-template-typescript module in conjunction with --scripts-version?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions