大佬教程收集整理的这篇文章主要介绍了在公司防火墙后使用create-react-app,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
看来此错误已得到修复,在版本1.1.0中不再存在。
此问题是由以下事实造成的:毛线注册表在react-
scripts中硬编码为registry.yarnpkg.com
:https ://github.com/facebookincubator/create-react-app/blob/master/packages/create-
react-app/createReactApp
.Js#L692
根据此拉取请求,如果无法访问yarn注册表,则它将检查是否https_proxy
设置了环境变量,如果是,则它将验证 该
服务器是否可访问,而不是硬编码的yarn注册表。
重申一下,在Npm / yarn中设置proxy / https-proxy配置是不够的-
您还需要设置https_proxy
环境变量,因为这是create-react-app在确定您是否在线时将检查的内容。例如:
https_proxy=https://my.corporate.proxy create-react-app my-new-project
create-react-app
通过设置代理,可以在公司防火墙后面使用任何方法。
我已经在Npm和yarn上设置了代理,但这是我在尝试执行create-react-app my-app
以下操作时看到的内容:
CreaTing a new React app in F:\react\my-app.
Installing packages. This might take a couple of minutes.
Installing react,react-dom,and react-scripts...
You appear to be offline.
falling BACk to the local Yarn cache.
yarn add v0.23.4
info No lockfile found.
[1/4] Resolving packages...
error Couldn't find any versions for "react" that matches "latest" in our cache. Possible versions: ""
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
AborTing installation.
yarnpkg add --exact --offline react react-dom react-scripts has failed.
deleting generated file... package.json
deleting my-app / from F:\react
Done.
以上是大佬教程为你收集整理的在公司防火墙后使用create-react-app全部内容,希望文章能够帮你解决在公司防火墙后使用create-react-app所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。