当我create-react-app my-app
在终端中键入命令时,它似乎可以正常工作-成功下载所有库,等等。但是,在该过程结束时,我收到一条消息,提示您template was not provided
。
输入项
user@users-MacBook-Pro-2 Desktop% create-react-app my-app
输出量
Creating a new React app in /Users/user/Desktop/my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
..... nothing out of the ordinary here .....
✨ Done in 27.28s.
A template was not provided. This is likely because you're using an outdated version of create-react-app.
Please note that global installs of create-react-app are no longer supported.
在的package.json中my-app
:
"dependencies": {
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-scripts": "3.3.0" <-- up-to-date
}
我检查了CRA 更改日志,看起来好像增加了对自定义模板的支持-但是看起来命令create-react-app my-app
似乎没有更改。
知道这里发生了什么吗?
yarn global upgrade create-react-app
-然后进行操作yarn create react-app my-app
locate create-react-app
删除create-react-app
名称中所有的目录。直到那时,npx create-react-app
终于为我再次正常工作。