我正在尝试使用 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/