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 fails on identical package names

See original GitHub issue

Expected Behaviour

Being able to manage multiple packages with same name but different tag.

Background

flow-typed is a central repository for Flow library definitions, a bit similar to Definitely-typed.

We maintain hundreds or thousands of library definitions (depending how you count them) that we should like to publish in NPM.

For this task we would like to use Lerna. The problem is that one version of library (libdef) might match multiple versions of flow, and each of them should be accessible separately form NPM. We’d like to have folders structure something like this:

  β”œβ”€β”€ alasql
  β”‚Β Β  └── alasql_v0.3.x
  β”‚Β Β      └── flow_v0.25.x-
  β”‚Β Β          └── index.js
  β”‚Β Β          └── package.json
  ...
  └── lodash
     β”œβ”€β”€ lodash_v4.x.x
     β”‚Β Β  └── flow_v0.28.x-v0.37.x
     β”‚Β Β      └── index.js
     β”‚Β Β      └── package.json
     β”‚Β Β  └── flow_v0.38.x-v0.46.x
     β”‚Β Β      └── index.js
     β”‚Β Β      └── package.json
     β”‚Β Β  └── flow_v0.63.x-
     β”‚Β Β      └── index.js
     β”‚Β Β      └── package.json

where each index.js would be published to NPM separately. But e.g in case of lodash, it has one version (4.x.x), but multiple flow version ranges under each version. We want to define flow version ranges in PublishConfig as tags, but to have the same version 4.0.0 in this case.

Here is an example of DefinitelyTyped library definitions utilizing tags: https://www.npmjs.com/package/@types/uuid <- see versions tab.

Current Behaviour

Currently Lerna gives following error:

lerna ERR! ENAME Package name "@flow-typed/a11y-dialog" used in multiple packages:
lerna ERR! ENAME        /Users/path/to/code/experimental/definitions/a11y-dialog/a11y-dialog_v5.x.x/flow_v0.25.x-v0.67.1
lerna ERR! ENAME        /Users/path/to/code/experimental/definitions/a11y-dialog/a11y-dialog_v5.x.x/flow_v0.68.x-

Possible Solution

A) provide --ignore-version-check flag or similar. B) provide ignoreVersionCheck as an lerna.json option

More context in flow-typed repository: https://github.com/flow-typed/flow-typed/issues/3083

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
polkovnikov-phcommented, Jul 6, 2021

I’m not sure about creating another issue, so I’ll add 2 cents here. A run of npm version results in

lerna notice cli v4.0.0
lerna info versioning independent
lerna ERR! ENAME Package name "@scope/package-name" used in multiple packages:
lerna ERR! ENAME        C:\Users\user\Documents\proj\scope\packages\package-name
lerna ERR! ENAME        C:\Users\user\Documents\proj\scope\packages\package-name

Yes, with 2 identical package names. The package is depended upon by 2 other packages. I don’t think version check works well here.

0reactions
rdzidziguricommented, Dec 12, 2022

Just in case, check your global package.json and make sure you do not have duplicates under workspaces.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lerna fails on identical package names - Bountysource
Lerna fails on identical package names. ... Expected Behaviour. Being able to manage multiple packages with same name but different tag.
Read more >
Lerna: Documentation
Lerna is a fast modern build system for managing and publishing multiple JavaScript/TypeScript packages from the same repository.
Read more >
Setting up a monorepo with Lerna for a TypeScript project
The lerna create command will guide us through the creation of a new package. It requires your new package's name to be passed...
Read more >
A guide through The Wild Wild West of setting up a mono repo ...
Lerna is a tool that optimizes the workflow around managing multi-package ... Here we will map our package names to their source code...
Read more >
monorepo - lerna ERR! EDESTDIR --dest does not match with ...
However, both fail with the same error. I want the repo to go to the packages/docs directory. lerna Β· monorepo.
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