lerna - 将 Lerna 与未发布的包一起使用

标签 lerna

我正在尝试使用 Lerna 设置我的 monorepo。该计划是通过提取应该是他们自己的包的代码块来重构现有项目。我跑了lerna init ,我当前的设置如下所示:

project/
  packages/
    new-refactored-package/
      package.json
    prior-existing-project/
      package.json
        { "dependencies" : { "new-refactored-package" : "latest" } }
  package.json
    {
      "devDependencies": {
        "lerna": "^2.0.0-rc.5"
      }
    }
  lerna.json
    {
      "lerna": "2.0.0-rc.5",
      "packages": [
        "packages/*"
      ],
      "version": "0.0.0"
    }

我的理解是 lerna bootstrap此时应该定位到package1在项目中并将其符号链接(symbolic link)到 prior-existing-project/node_modules/new-refactored-package/ .来自 lerna's readme :

Bootstrap the packages in the current Lerna repo. Installs all of their dependencies and links any cross-dependencies.

When run, this command will:

  • npm install all external dependencies of each package.
  • Symlink together all Lerna packages that are dependencies of each other.
  • npm prepublish all bootstrapped packages.


但是,当我运行它时,lerna 会尝试 npm install new-refactored-package :

npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/new-refactored-package



我是不是误会了?我是否首先必须将依赖的包发布到 npm ?

最佳答案

尝试使用“lerna add ”命令安装依赖项,而不是手动添加依赖项。这将自动添加本地版本(如果可用)

关于lerna - 将 Lerna 与未发布的包一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44491525/

相关文章:

node.js - LernaJS typescript 找不到模块

reactjs - 使用代码拆分创建 React 组件 UI 库

yarnpkg - 当我尝试升级某些依赖项时,为什么 Yarn 会抛出 "Invariant Violation: expected workspace package to exist"?

node.js - 勒纳致命 : ambiguous argument 'origin/heads/origin/master...heads/origin/master' : unknown revision or path not in the working tree

yarnpkg - 避免 Husky 被 monorepo 项目中每个不相关目录的更改触发

javascript - Babel 预设未在 monorepo 项目上加载

javascript - Lerna bootstrap 不链接本地依赖项?

package.json - 从嵌套的 Lerna 包中删除依赖项

javascript - 如何屏蔽 Lerna 包的内部结构,使其他包无法导入它们?

lerna - pnpm 等同于 lerna 的 --since 选项