[英]npx create-react-app running with old version
The latest version create-react-app
is 4.0.3
but when I run npx create-react-app my-app
it uses version 1.5.2 and also doesn't run with templates.最新版本的
create-react-app
是4.0.3
但是当我运行npx create-react-app my-app
它使用版本 1.5.2 并且也不能使用模板运行。 I don't have any global installation of it and have tried uninstalling it using npm uninstall -g create-react-app
.我没有任何全局安装,并尝试使用
npm uninstall -g create-react-app
卸载它。
My npm version is 7.21.1 and node version is 16.9.1我的 npm 版本是 7.21.1,node 版本是 16.9.1
How can I make it work?我怎样才能让它工作? Please help.
请帮忙。
EDIT: There are 58 vulnerabilities while creating the app and this comes at the end -编辑:创建应用程序时有 58 个漏洞,这在最后 -
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.
You can fix this by running npm uninstall -g create-react-app or yarn global remove create-react-app before using create-react-app again.
The folder also doesn't have the src
folder just the node_modules
folder and package.json
file.该文件夹也没有
src
文件夹,只有node_modules
文件夹和package.json
文件。
While running npm audit fix
I get this -在运行
npm audit fix
我得到了这个 -
tar <=4.4.17
Severity: high
Arbitrary File Creation/Overwrite on Windows via insufficient relative path sanitization - https://github.com/advisories/GHSA-5955-9wpr-37jh
Arbitrary File Creation/Overwrite via insufficient symlink protection due to directory cache poisoning using symbolic links - https://github.com/advisories/GHSA-9r2w-394v-53qc
Arbitrary File Creation/Overwrite due to insufficient absolute path sanitization - https://github.com/advisories/GHSA-3jfq-g458-7qm9
Arbitrary File Creation/Overwrite via insufficient symlink protection due to directory cache poisoning - https://github.com/advisories/GHSA-r628-mhmh-qjhw
fix available via `npm audit fix`
node_modules/tar
tar-pack *
Depends on vulnerable versions of tar
node_modules/tar-pack
create-react-app >=1.3.0-alpha.58689133
Depends on vulnerable versions of tar-pack
node_modules/create-react-app
3 high severity vulnerabilities
Short version:简洁版本:
npx clear-npx-cache
Temporary solution:临时解决方案:
npx create-react-app@latest my-app
Now for the explanation.现在解释一下。 I think npx is running an old version of create-react-app on your computer.
我认为 npx 在您的计算机上运行旧版本的 create-react-app。 The first time you do
npx create-react-app
, the package is installed in the cache.第一次执行
npx create-react-app
,包会安装在缓存中。 npx does not check for newer versions if the package is cached. NPX不检查新版本如果包缓存。 You can sidestep this issue by adding @latest.
您可以通过添加@latest 来回避这个问题。 This forces npx to fetch the package even if it is cached.
这会强制 npx 获取包,即使它已被缓存。
A better solution is to clear the cache.更好的解决方案是清除缓存。 There are other guides about how to find and remove the cache folder on windows and macos.
还有其他关于如何在 windows 和 macos 上查找和删除缓存文件夹的指南。 The package
clear-npx-cache
does this.包
clear-npx-cache
执行此操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.