question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

lerna ERR! TypeError: Cannot read property 'version' of undefined

See original GitHub issue

Current Behavior

There are two packages,package-a and package-b.

package-b dependencies package-a,using the Workspace protocol.

package-b

{
"name": "package-b",
"version": "1.0.1",
"dependencies": {
    "package-a": "workspace:*"
  }
}

Expected Behavior

Run npx lerna publish from-package

Expected successful publish

Steps to Reproduce

$ npx lerna publish from-package
lerna notice cli v5.5.2
lerna info versioning independent
lerna WARN Unable to determine published version, assuming "package-b" unpublished.

Found 1 package to publish:
 - package-b => 1.0.1

? Are you sure you want to publish these packages? Yes
lerna info publish Publishing packages to npm...
lerna WARN ENOLICENSE Package package-b is missing a license.
lerna WARN ENOLICENSE One way to fix this is to add a LICENSE.md file to the root of this repository.
lerna WARN ENOLICENSE See https://choosealicense.com for additional guidance.
lerna ERR! TypeError: Cannot read property 'version' of undefined
lerna ERR!     at /Users/xxx/node_modules/.pnpm/@lerna+package-graph@5.5.2/node_modules/@lerna/package-graph/index.js:80:37
lerna ERR!     at Array.forEach (<anonymous>)
lerna ERR!     at /Users/xxx/node_modules/.pnpm/@lerna+package-graph@5.5.2/node_modules/@lerna/package-graph/index.js:60:38
lerna ERR!     at Map.forEach (<anonymous>)
lerna ERR!     at new PackageGraph (/Users/xxx/node_modules/.pnpm/@lerna+package-graph@5.5.2/node_modules/@lerna/package-graph/index.js:49:10)
lerna ERR!     at new QueryGraph (/Users/xxx/node_modules/.pnpm/@lerna+query-graph@5.5.2/node_modules/@lerna/query-graph/query-graph.js:48:18)
lerna ERR!     at runTopologically (/Users/xxx/node_modules/.pnpm/@lerna+run-topologically@5.5.2/node_modules/@lerna/run-topologically/run-topologically.js:23:17)
lerna ERR!     at PublishCommand.topoMapPackages (/Users/xxx/node_modules/.pnpm/@lerna+publish@5.5.2/node_modules/@lerna/publish/index.js:639:12)
lerna ERR! lerna Cannot read property 'version' of undefined

Failure Logs / Configuration

lerna.json

{
  "$schema": "node_modules/lerna/schemas/lerna-schema.json",
  "useNx": true,
  "useWorkspaces": true,
  "npmClient": "pnpm",
  "version": "independent"
}

Environment

  • macOS Monterey 12.5, Apple M1 Pro
  • node@v14.20.0
  • pnpm@v7.9.0
  • lerna@5.5.2

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:6
  • Comments:7

github_iconTop GitHub Comments

1reaction
fahslajcommented, Oct 10, 2022

Hi everyone, thank you for your engagement on this issue. It has since been addressed in PR #3358. The problem should be fixed with Lerna version 5.6.2.

0reactions
GNARGNARDAVEcommented, Nov 8, 2022

Yeah, I see the same issue on 6.0.5

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'version' of undefined Vue.js - Stack ...
From my experience it may happen if there is import of package.json in one of your project's files, but with incorrect path. Usually,...
Read more >
TypeError: Cannot read property 'version' of undefined
Just do npm install eslint inside the project. It should work. [ad_2]. Content Protection by DMCA.com. Please Share.
Read more >
npm err! cannot read properties of null (reading 'children') npm ...
my npm version is 8.1.4 and i solve this problem by running : ... was created) ERR! TypeError: Cannot read properties of undefined...
Read more >
rushstack/rushstack - Gitter
Deleting /Users/gliba/src/tmp/kittik/common/config/rush/pnpm-lock.yaml ERROR: Cannot read property 'getWorkspaceKeyByPath' of undefined TypeError: Cannot ...
Read more >
NPM - Cannot read property "match" of undefined
When trying to run an npm command, you can't install the packages, you may get the error: stephen... Tagged with npm, troubleshooting, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found