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

Nodejs resolve name overrides not being applied when checking for duplicates #21524

Open
rokos-angus opened this issue Oct 14, 2024 · 0 comments
Labels

Comments

@rokos-angus
Copy link

rokos-angus commented Oct 14, 2024

Describe the bug
I have a repo with the following structure

apps
  my-app
    frontend
      package.json
      package-lock.json
      BUILD
  my-other-app
    frontend
      package.json
      package-lock.json
      BUILD

And the following in config

[source]
root_patterns = [
  "/apps/*",
]

[nodejs.resolves]
"my-lock" = "apps/my-app/frontend/package-lock.json"
"my-other-lock" = "apps/my-other-app/frontend/package-lock.json"

But running e.g. pants generate-lockfiles --resolve=my-lock Gives the error

10:50:36.15 [ERROR] 1 Exception encountered:

Engine traceback:
  in `generate-lockfiles` goal

ValueError: Projects with root directories 'apps/my-other-app/frontend' and 'apps/my-app/frontend' have the same resolve name frontend. This will cause ambiguities.

To disambiguate, either:

  * Configure [nodejs].resolves to grant the package.json directories different names.
  * Make one package a workspace of the other.
  * Re-configure your source root(s).

However the resolve works with the overridden name when deleting one of the projects.
E.g. deleting apps/my-other-app and running pants generate-lockfiles --resolve=my-lock gives

10:58:52.59 [INFO] Wrote lockfile for the resolve `my-lock` to apps/my-app/frontend/package-lock.json

Pants version
2.22 (but reproducible with 2.23.0rc0 and 2.24.0.dev1)

OS
Ubuntu 22.04

Additional info
Add any other information about the problem here, such as attachments or links to gists, if relevant.

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

No branches or pull requests

1 participant