简体   繁体   English

Create-react-app 依赖版本问题

[英]Create-react-app dependency version issues

I am trying to create a basic react app using the command:我正在尝试使用以下命令创建一个基本的 React 应用程序:

npx create-react-app my-app

At work we use JFrog Artifactory to manage our npm packages.在工作中,我们使用 JFrog Artifactory 来管理我们的 npm 包。 When trying to use the above command, I get the following error:尝试使用上述命令时,出现以下错误:

npm ERR! 403 403 Forbidden - GET https://artifactory.XYZ.domain:443/artifactory/api/npm/npm-main/ansi-regex/-/ansi-regex-4.1.0.tgz
npm ERR! 403 In most cases, you or one of your dependencies are requesting
npm ERR! 403 a package version that is forbidden by your security policy.
npm ERR! 403
npm ERR! 403 It was specified as a dependency of 'wrap-ansi'

Sure enough, when I look in Artifactory I can see that v4.0.1 is blocked due to a security vulnerability.果然,当我查看 Artifactory 时,我可以看到 v4.0.1 由于安全漏洞而被阻止。 What are my options here please?请问我有什么选择? Is it possible to somehow force create-react-to instead use a later version without the vulnerability (looks like v5.0.1 is fine)?是否有可能以某种方式强制 create-react-to 而不是使用没有漏洞的更高版本(看起来 v5.0.1 很好)?

Thanks for your help谢谢你的帮助

you can do你可以做

npm config set registry <path/to/artifactory>

///create your react project:- npm create-react-app myapp

//then revert to older config if you want to by 

npm config delete registry

let me know if it works让我知道它是否有效

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM