首页 > 解决方案 > npx create-react-app my-app --template typescript is not generating any TypeScript files

问题描述

npx create-react-app my-app --template typescript is not generating any TypeScript files, it just making a normal JS project.

I have globally uninstalled create-react-app from my npm as I have seen that suggested as a solution to this before.

Logs:

$ npx create-react-app my-app --template typescript
npx: installed 80 in 7.19s

Creating a new React app in C:\code\my-app.

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


> core-js@2.6.12 postinstall C:\code\my-app\node_modules\babel-preset-react-app\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"


> core-js@2.6.12 postinstall C:\code\my-app\node_modules\babel-register\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"


> core-js@2.6.12 postinstall C:\code\my-app\node_modules\babel-runtime\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"

+ react@0.14.9
+ react-scripts@0.9.5
+ react-dom@0.14.9
added 912 packages from 647 contributors in 50.852s

Success! Created my-app at C:\code\my-app
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 my-app
  npm start

Happy hacking!

The created project structure files are all .js, and there is no TypeScript in the package.json.

标签: typescriptcreate-react-app

解决方案


推荐阅读