Yarn - Workspaces - Lerna - 我无法使用工作区功能添加我的包

Yarn - Workspaces - Lerna - I fail to use the workspaces feature to add my packages

我有这个文件夹树:

my_project_tree 
|
├── lerna.json
├── package.json
├── package-lock.json
├── packages
│   └── editor_implementation
│       ├── dist
│       ├── package.json
│       └── src
│          
├── yarn-error.log
└── yarn.lock

我的editor_implementation/package.json有以下内容:

{
  "name": "@my_project_tree/editor_implementation",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT"
}

我的根文件夹 my_project_tree/package.json 具有以下内容:

{
  "name": "hocotext",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "workspaces": [
    "packages/*"
  ],
  "private": true,
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "dotenv": "^6.0.0"
  },
  "devDependencies": {
    "lerna": "^3.4.0"
  }
}

我的 lerna.json 在根级别有以下内容:

{
  "version": "patch",
  "command": {
    "publish": {
      "ignoreChanges": [
          "ignored-file",
          "node_modules",
          "*.md"
      ]
    },
    "bootstrap": {
      "ignore": "component-*",
      "npmClientArgs": ["--no-package-lock"]      
    }
  },
 "npmClient": "yarn",
 "useWorkspaces": true,
 "packages": ["packages/*"]
}

当我从 root 运行:

所有命令都失败,消息抽象为:

Uknow package...

Package {} not found...

我不知道哪里出了问题,因为在我看来我已经满足了所有要求,如果有人有任何提示,那就太好了。

为了找到您的工作区,您只需 运行 :

yarn workspaces info

在我的例子中 returns:

{
  "@hoco_editor/editor_implementation": {
    "location": "packages/editor_implementation",
    "workspaceDependencies": [],
    "mismatchedWorkspaceDependencies": []
  }
}

所以我有 运行 我的 @hoco_editor/editor_implementation 命令如下:

 yarn workspace @hoco_editor/editor_implementation add °some packages°

它就像一个魅力。