关于create-react-app(react-scripts@3.3.0)升级的坑
作者:互联网
今天用create-react-app my-app,看到下面的提示:
<style></style> <style></style>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中你会看到react-scripts升级到了3.3.0,它不再支持全局安装CRA(create-react-app)。
查了一些资料,朋友们都说用npx create-react-app my-app可以,经过我不断试错,才发现前提是一定要先卸载全局CRA才能成功!
所以,卸载全局CRA
<style></style>npm uninstall -g create-react-app
但是发现卸不掉CRA,因为下面的command还可以拿到它的版本号:
<style></style>create-react-app -V
->3.0.1
怎么办嘞?那就手动删除吧,执行下面的command:
which create-react-app
->/usr/local/bin/create-react-app
<style></style>rm -rf /usr/local/bin/create-react-app
<style></style>
create-react-app -V
-bash: /usr/local/bin/create-react-app: No such file or directory
删除成功!
最后用npx就快速生成react项目,运行OK
<style></style> <style></style>npx create-react-app my-app
标签:bin,app,react,CRA,usr,scripts,create 来源: https://www.cnblogs.com/hanlinbaiyu/p/12074660.html