cd 到对应的项目目录执行 yarn 报错
➜ elderHealth git:(master) ✗ yarn install
Usage Error: The nearest package directory (/Users/xiaoye/practice/jiedan/elderHealth) doesn't seem to be part of the project declared in /Users/xiaoye.
- If /Users/xiaoye isn't intended to be a project, remove any yarn.lock and/or package.json file there.
- If /Users/xiaoye is intended to be a project, it might be that you forgot to list practice/jiedan/elderHealth in its workspace configuration.
- Finally, if /Users/xiaoye is fine and you intend practice/jiedan/elderHealth to be treated as a completely separate project (not even a workspace), create an empty yarn.lock file in it.
报错信息大概是说yarn的文件文件路径不对
Usage Error: The nearest package directory ({path}) doesn’t seem to be
part of the project declared in {path}.
解决方法
通过查找网上的解决方案,然后发现项目目录中没有yarn.lock文件。在对应目录加一个空白yarn.lock
文件 再重新执行yarn
就可以了。