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

Can't Scaffold TypeScript Project Anymore... #12443

Open
JimLynchCodes opened this issue May 27, 2022 · 4 comments
Open

Can't Scaffold TypeScript Project Anymore... #12443

JimLynchCodes opened this issue May 27, 2022 · 4 comments

Comments

@JimLynchCodes
Copy link

JimLynchCodes commented May 27, 2022

When I run the command:

npx create-react-app cra-example-app --template typescript

it ends with this strange message and creates a js project that doesn't seem to build...


The react-scripts version you're using is not compatible with the --template option.

Installing react, react-dom, and react-scripts...


@404answernotfound
Copy link

404answernotfound commented May 30, 2022

The command works properly. It appears it could be a node version problem based on the npx installation?

I used node v14. Could you give more details on the versions you are using?

Also, the name of the project is really not nice. Add more specifics and be nicer please :)

➜  npx create-react-app cra-project --template typescript

npx: installato 67 in 7.591s

Creating a new React app in /OpenSource/cra-project.

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


> core-js@3.22.7 postinstall /OpenSource/cra-project/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"


> core-js-pure@3.22.7 postinstall /OpenSource/cra-project/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"

+ cra-template-typescript@1.2.0
+ react-scripts@5.0.1
+ react-dom@18.1.0
+ react@18.1.0
added 1394 packages from 625 contributors in 100.1s

185 packages are looking for funding
  run `npm fund` for details


Initialized a git repository.

Installing template dependencies using npm...
npm WARN @apideck/better-ajv-errors@0.3.4 requires a peer of ajv@>=8 but none is installed. You must install peer dependencies yourself.

+ web-vitals@2.1.4
+ @testing-library/jest-dom@5.16.4
+ @types/node@16.11.36
+ @testing-library/user-event@13.5.0
+ @types/react-dom@18.0.5
+ @types/jest@27.5.1
+ @testing-library/react@13.3.0
+ @types/react@18.0.9
+ typescript@4.7.2
added 40 packages from 110 contributors and updated 1 package in 12.412s

185 packages are looking for funding
  run `npm fund` for details


We detected TypeScript in your project (src/App.test.tsx) and created a tsconfig.json file for you.

Your tsconfig.json has been populated with default values.

Removing template package using npm...

npm WARN @apideck/better-ajv-errors@0.3.4 requires a peer of ajv@>=8 but none is installed. You must install peer dependencies yourself.

removed 1 package and audited 1436 packages in 5.364s

185 packages are looking for funding
  run `npm fund` for details

found 1 high severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details

Created git commit.

Success! Created cra-project at /OpenSource/cra-project
Inside that directory, you can run several commands:

  npm start
    Starts the development server.

  npm run build
    Bundles the app into static files for production.

  npm test
    Starts the test runner.

  npm run eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!

We suggest that you begin by typing:

  cd cra-project
  npm start

Happy hacking!
➜  node -v
v14.18.3

@uloco
Copy link

uloco commented May 31, 2022

try this npx clear-npx-cache

@mikeaustin
Copy link

mikeaustin commented Jun 9, 2022

UPDATE: Running npm cache clean --force did fix the issue with using nxp create-react-app.

Hmm, "npx create-react-app foo --template typescript" is creating a folder with package.json, package-lock.json and node_modules and that's it. I've done npx clear-npx-cache and nothing changes. Using npm 6.14.16 / node 14.19.0.

package.json is package.json only has a few properties:

{
  "name": "container",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^18.1.0",
    "react-dom": "^18.1.0",
    "react-scripts": "5.0.1"
  }
}

If I install create-react-app globally with npm install -g create-react-app, it seems to work correctly. So this is not an issue with create-react-app, but it is a bad experience. What else would cause this issue?

@kiprasmel
Copy link

i had a similar problem when running thru npx or yarn create:

$ npx create-react-app ./client --template typecript             
npx: installed 67 in 19.558s

Creating a new React app in [DIR].

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

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/cra-template-typecript - Not found
npm ERR! 404 
npm ERR! 404  'cra-template-typecript@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

Aborting installation.
  npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template-typecript has failed.

and indeed, first installing globally yarn global add create-react-app and then running the executable directly -- solved the problem.

very strange behavior...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants