node.js – 在公司防火墙后面使用create-react-app

通过设置代理,可以使用create-react-app在公司防火墙后面工作.

我已经在npm和yarn上设置了代理,但这是我在尝试创建 – 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.

解决方法

作为一种解决方法,首先尝试在空文件夹中运行yarn add react react-dom react-scripts.这会将所需的包添加到yarn的本地缓存中.然后,您可以删除文件夹并再次运行create-react-app my-app,它将有希望工作.

相关文章

这篇文章主要介绍“基于nodejs的ssh2怎么实现自动化部署”的...
本文小编为大家详细介绍“nodejs怎么实现目录不存在自动创建...
这篇“如何把nodejs数据传到前端”文章的知识点大部分人都不...
本文小编为大家详细介绍“nodejs如何实现定时删除文件”,内...
这篇文章主要讲解了“nodejs安装模块卡住不动怎么解决”,文...
今天小编给大家分享一下如何检测nodejs有没有安装成功的相关...