Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue in using workspace: protocol in lerna versioning / publish. #3317

Closed
HariAbinesh opened this issue Sep 5, 2022 · 6 comments
Closed

Comments

@HariAbinesh
Copy link

Issue in using workspace: protocol in lerna versioning.

package A has two dependencies in workspace -> package B , C.

when we modify only package A and trigger lerna version or publish, it fails.

Current Behavior

lerna version / publish throws validation error.
To use the 'workspace:' protocol, ensure that a package with name "${depName}" exists in the current workspace.

Expected Behavior

Lerna version / publish should succeed.

Steps to Reproduce

package A has two dependencies in workspace -> package B , C

modify only package A and try versioning.

Reason

First time, package graph will have all available workspace packages info in its Map.
But after lerna tries to write package json and CHANGELOG, the package graph will only have packages to publish info. so it fails.

// File: package-graph/index.js line:60

 Object.keys(graphDependencies).forEach((depName) => {
        const depNode = this.get(depName);
// Here , the depNode will not be available.

Environment

(lerna: 5.5.0 => 5.5.0)

@fahslaj
Copy link
Contributor

fahslaj commented Sep 7, 2022

Hi @HariAbinesh, thank you for opening this issue. I was able to successfully reproduce the problem described above and am currently working on a fix.

@JamesHenry
Copy link
Member

@HariAbinesh this should be resolved in 5.5.1 thanks to @fahslaj

@forehalo
Copy link

forehalo commented Sep 15, 2022

@JamesHenry unfortunately, #3322 did not solve this issue soundly, and I've met another issue related to this scenario.

Error says the following line in @lerna/package-graph/index.js didn't do nullish check(removed in #3322) before using it:

const depNode = this.get(depName);
// L80 C37
// TypeError: Cannot read properties of undefined (reading 'version')
const version = depNode.version;

I've created a repo to reproduce it: lerna-version-issue

@fox1t
Copy link

fox1t commented Sep 19, 2022

Same error here. I am not sure what should be the correct behavior, though. The version will be resolved later when the workspace protocol is used.

@joakimbeng
Copy link

I'm having the same issue as well!

@matteovivona
Copy link

On 5.6.1 the issue remains #3343

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants