Skip to content

fix(install): resolve package.json dependencies in global install#35135

Open
bartlomieju wants to merge 1 commit into
mainfrom
fix/install-global-package-json
Open

fix(install): resolve package.json dependencies in global install#35135
bartlomieju wants to merge 1 commit into
mainfrom
fix/install-global-package-json

Conversation

@bartlomieju

Copy link
Copy Markdown
Member

deno install --global with a local file entrypoint failed when the project
declared its dependencies in package.json: the installer copies the supplied
config (or an empty one) into a per-binary directory and builds and runs the
command with that config, so the project's package.json was never consulted
and bare specifiers errored with Import "x" not a dependency.

This flattens the dependencies of the entrypoint's closest package.json into
the copied config's import map, the same way workspace members are already
flattened there (#32057). Aliased npm and jsr dependencies map verbatim, and
subpath imports get a trailing-slash entry in the npm:/pkg@req/ form (the
npm:pkg@req/ form is an opaque-path URL that subpaths cannot be URL-joined
onto). Non-registry dependencies (file:, workspace:, catalog:) are skipped
with a warning. Explicit import map entries and workspace member entries take
precedence.

Fixes #26412

Flatten dependencies from the entrypoint's closest package.json into the
import map of the config that deno install --global copies into the
per-binary directory, so bare specifiers keep resolving both while
building the install graph and when running the installed command.

Fixes #26412
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to deno install --global from local directory when using package.json

1 participant