Skip to content

jsr: specifiers are not installed into node_modules (unlike npm:) #33370

@Shadowner

Description

@Shadowner

Version: Deno 2.7.12, Linux.
deno install populates node_modules/ with npm: specifiers but not jsr: ones. JSR packages go only to the global cache at ~/.cache/deno/, this holds for both "nodeModulesDir": "auto" and "manual".

Any Node-based tool that walks standard module resolution into a Deno source file (tsc, svelte-check, Vite, TS language server) fails on the jsr: import. In a Deno-backend + Node-frontend monorepo a single unresolved JSR specifier produces a large number of downstream implicit-any errors

I've found some related issues #26138 #26772

Reproduction

I've made a small reproduction here : https://github.com/Shadowner/Deno-Node-JSR-Issue

Excpected

Both specifiers resolve, or at minimum jsr: and npm: behave the same way under nodeModulesDir

What could be done

Make so that "nodeModulesDir": "auto" | "manual" for jsr: specifiers the same way it does for npm:, create a top-level node_modules/@scope/pkg symlink (or directory) mirroring the alias users write in source (@std/ulid, not @jsr/std__ulid)
That single change makes mixed-runtime type consumption work under every standard node-resolution-based tool

I didn't find any workaround other than creating a script that creates those symlink to prevent this error, I'm open to any solution cleaner than doing a script

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions