请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

create-react-app error

bash-3.2$ npx create-react-app my-app-ts --template typescript

Creating a new React app in /Users/zxc/A_work/Project/UI/learning/React/my-app-ts.

warning …/…/…/…/…/…/package.json: No license field
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template-typescript…

You appear to be offline.
Falling back to the local Yarn cache.

yarn add v1.22.10
warning …/…/…/…/…/…/package.json: No license field
[1/4] 🔍 Resolving packages…

error An unexpected error occurred: “There should only be one folder
in a package cache (got in
/Users/zxc/Library/Caches/Yarn/v6/npm-@babel-helper-annotate-as-pure-7.12.13-0f58e86dfc4bb3b1fcd7db806570e177d439b6ab-integrity/node_modules/@babel)”.

正在回答 回答被采纳积分+3

1回答

阿莱克斯刘 2021-06-17 01:17:21

可能是你电脑的本地缓存出了问题,试试执行以下命令清除一下local cache

yarn cache clean


0 回复 有任何疑惑可以回复我~
  • 提问者 Zhang_Kyra #1
    清除缓存后,
    error Couldn't find any versions for "react" that matches "latest" in our cache (possible versions are ""). This is usually caused by a missing entry in the lockfile, running Yarn without the --offline flag may help fix this issue.
    然后,执行了yarn add react
    又重新执行npx create-react-app my-app-ts --template typescript, error如下:
    error Can't make a request in offline mode ("https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.15.2.tgz")
    怎样关闭offline mode? 尝试执行 yarn --prefer-online, 但是没有解决,仍然是offline mode
    回复 有任何疑惑可以回复我~ 2021-06-17 14:30:06
  • 提问者 Zhang_Kyra #2
    resolved.  in offline mode, will hit the local cache issue.
    回复 有任何疑惑可以回复我~ 2021-06-17 15:53:30
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信