首页 > 解决方案 > 在创建反应应用程序时,进程停止并显示 1 个漏洞(运行 npm 审计)

问题描述

运行 npx create-react-app app-name 时,进程在运行 npm audit fix 时自动停止,并且不显示任何错误

我也使用不同的命令来解决这个问题

update npm globally

npm install -g create-react-app

create-react-app my-app

或者

install yarn

yarn create react-app my-app

或者

npm cache clean --force

npx create-react-app my-app

但没有什么对我有用,它总是在运行 npm 审计漏洞时停止

    PS D:\mern> npx create-react-app client    

Creating a new React app in D:\mern\client.

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


> core-js@2.6.11 postinstall D:\mern\client\node_modules\babel-runtime\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"


> core-js@3.6.5 postinstall D:\mern\client\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"


> core-js-pure@3.6.5 postinstall D:\mern\client\node_modules\core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"

+ cra-template@1.0.3
+ react-scripts@3.4.1
+ react@16.13.1
+ react-dom@16.13.1
added 1626 packages from 750 contributors and audited 1630 packages in 257.371s

59 packages are looking for funding
  run `npm fund` for details

标签: node.jsreactjsreact-nativenpm

解决方案


好吧,您可以运行npm audit fix以尝试修复它。有些项目确实有 1 个或多个漏洞,可悲的是,这是正常的,如果npm audit fix没有帮助,请尝试npm audit fix --force

[编辑] 另外,如命令输出所述:

添加了来自 750 个贡献者的 1626 个包,并在 257.371 秒内审核了 1630 个包

添加了软件包,没有错误,只是关于最近添加的 1626 个软件包中的一个漏洞的警报。

因此,如果您不关心那个漏洞,您可以编译您的项目。


推荐阅读