【发布时间】:2019-02-07 19:29:04
【问题描述】:
有任何方法可以通过设置代理在公司防火墙后面使用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的最新版本在检测代理等方面变得更加智能。请确保您运行的是最新版本,然后重试!