yarn-v2 - 初始化 yarn 2,添加失败

标签 yarn-v2

我正在试验2号纱和植面。
我创建了一个新文件夹:/projects/yarn2/根据他们的安装指南https://yarnpkg.com/getting-started我跑了

cd /projects/yarn2/
yarn set version berry
yarn init
然后(按照他们的指南https://yarnpkg.com/getting-started/usage)yarn add react并得到以下错误:
Usage Error: The nearest package directory (/projects/yarn2) doesn't seem to be part of the project declared in /projects.

- If the project directory is right, it might be that you forgot to list yarn2 as a workspace.
- If it isn't, it's likely because you have a yarn.lock or package.json file there, confusing the project root detection.

$ yarn add [--json] [-E,--exact] [-T,--tilde] [-C,--caret] [-D,--dev] [-P,--peer] [-O,--optional] [--prefer-dev] [-i,--interactive] [--cached] ...
我究竟做错了什么?

最佳答案

检查/projects目录中是否有package.jsonyarn.lock文件。如果这样做,请清除/清除它们,然后它应该开始工作。

关于yarn-v2 - 初始化 yarn 2,添加失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64048830/

相关文章:

node.js - Yarn 2 工作区未安装依赖项

yarnpkg - 我如何在 Yarn 2 中共享工作区中的公共(public)依赖项?

yarnpkg - 为什么我的项目中缺少yarnrc.yml 文件?

create-react-app - 如何使用 Yarn 2 创建 React App?

typescript - 使用yarn作为包管理器添加存储库时找不到模块

typescript - 如何配置 VSCode 以运行 Yarn 2(使用 PnP)驱动的 TypeScript

javascript - Jenkins Buildmaster Dependency-Track 对 Yarn 决议没有反应

javascript - 在 WSL 上运行 Cypress

yarnpkg - yarn 版本之间的区别