[英]How to upgrade node module of the lerna's subpackage
I started using lerna to be able to install all node modules for all sub packages using a single command.我开始使用lerna以便能够使用单个命令为所有子包安装所有节点模块。 At the moment I do not use any other lerna features except lerna bootstrap
.目前,除了lerna bootstrap
之外,我不使用任何其他 lerna 功能。 My lerna.json
:我的lerna.json
:
{
"lerna": "3.22.0",
"npmClient": "yarn",
"packages": [
"package-a",
"package-b"
],
"version": "1.0.0"
}
my root package.json
:我的根package.json
:
{
"name": "test",
"private": true,
"version": "1.0.0",
"scripts": {
"postinstall": "lerna bootstrap"
},
"dependencies": {
"lerna": "^3.22.1"
}
}
my package-a
's package.json
:我的package-a
的package.json
:
{
"name": "package-a",
"version": "1.0.0",
"private": true,
"dependencies": {
"moment": "2.22.0"
}
}
my package-b
's package.json
:我的package-b
的package.json
:
{
"name": "package-b",
"version": "1.0.0",
"private": true,
"dependencies": {
"package-a": "1.0.0",
"moment": "2.22.0"
}
}
i want to upgrade moment
in the package-b
.我想升级package-b
中的moment
。 if i run yarn upgrade moment --latest
in the package-b
folder i got the following error:如果我在package-b
文件夹中运行yarn upgrade moment --latest
, yarn upgrade moment --latest
出现以下错误:
yarn upgrade v1.22.5
[1/4] 🔍 Resolving packages...
error Received malformed response from registry for "package-a". The registry may be down.
info Visit https://yarnpkg.com/en/docs/cli/upgrade for documentation about this command.
if i run npx lerna --scope package-b exec -- "yarn upgrade moment --latest"
in the root folder i get the following error:如果我在根文件夹中运行npx lerna --scope package-b exec -- "yarn upgrade moment --latest"
我收到以下错误:
lerna notice cli v3.22.1
lerna notice filter including "package-b"
lerna info filter [ 'package-b' ]
lerna info Executing command in 1 package: "yarn upgrade moment --latest"
yarn upgrade v1.22.5
[1/4] 🔍 Resolving packages...
error Received malformed response from registry for "package-a". The registry may be down.
info Visit https://yarnpkg.com/en/docs/cli/upgrade for documentation about this command.
lerna ERR! yarn upgrade moment --latest exited 1 in 'package-b'
lerna ERR! yarn upgrade moment --latest exited 1 in 'package-b'
How should I properly upgrade node module in the lerna's sub-package?我应该如何正确升级lerna子包中的节点模块?
Because both of your packages are private the npm
repository can't find them during the upgrade of the moment
library.由于您的两个包都是私有的,因此在升级moment
库期间, npm
存储库无法找到它们。 Also the lerna
package is currently largely unmaintained.此外, lerna
包目前基本上没有维护。
There exists a workaround.存在一种解决方法。 Temporally delete the "package-a": "1.0.0",
line from your package-b.json
file.暂时删除package-b.json
文件中的"package-a": "1.0.0",
行。
Updated package-b/package.json
file:更新了package-b/package.json
文件:
{
"name": "package-b",
"version": "1.0.0",
"private": true,
"dependencies": {
"moment": "2.22.0"
}
}
Now run:现在运行:
cd package-b && yarn upgrade moment --latest && cd ..
Then put the "package-a": "1.0.0",
line back to your package-b.json
file.然后把"package-a": "1.0.0",
放回你的package-b.json
文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.