如何在运行npm install时使用类似于 `--registry https://registry.npmjs.org` 的东西来运行npx以避免Artifactory?

15
< p > --registry https://registry.npmjs.org 用于在使用npm install安装时避开Artifactory代理,但我想在npm xxx中进行类似的操作,因为我遇到了

--registry https://registry.npmjs.org可以用于通过npm install绕过类似于Artifactory的代理,但我希望在使用npm xxx时做类似的事情,因为我遇到了问题。
npm ERR! code E401
npm ERR! Unable to authenticate, need: Basic realm="Artifactory Realm"

当尝试执行npx create-react-app myapp时,这是否可行?

我真的找不到任何关于这个的信息!


这个回答中的解决方案可能会对你有所帮助:https://dev59.com/sVQJ5IYBdhLWcg3wg2X4 - kitimenpolku
1个回答

19

您可以运行类似以下命令:

npm_config_registry=https://registry.npmjs.org npx xxx

这是由npm团队建议的。我遇到了同样的问题,但那是因为我需要让npx指向一个私有仓库。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接