yarn create react-app antd-demo-ts --typescript 无效

环境

系统: OS X 10.14
nodejs: 8.9
npm: 6.11.3
yarn: 1.19.2
creat-react-app: 3.2.0

在antd文档上,使用yarn create react-app antd-demo-ts --typescriptnpx create-react-app antd-demo-ts --typescript命令去创建一个TS项目,最终生成的都是js项目
image.png

求解,问题出在哪一部?

阅读 5.6k
4 个回答

全局安装的默认路径有问题,可能是之前多次安装卸载nodejs导致。

解决方法:

先运行

npm config get prefix

查看一下当前的设置,如果路径为’/usr/local/Cellar/node/‘,则执行下面的语句:

npm config set prefix /usr/local

先试着执行这个npm uninstall -g create-react-app,详见这个issues

新手上路,请多包涵

使用

yarn create react-app antd-demo-ts --template typescript

即可解决

推荐问题