我正在试验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.json
或yarn.lock
文件。如果这样做,请清除/清除它们,然后它应该开始工作。
关于yarn-v2 - 初始化 yarn 2,添加失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64048830/