`pnpm dlx ts-node` does not work akin to `npx ts-node` · pnpm · Discussion #6117 · GitHub
Skip to content
Discussion options

You must be logged in to vote

The original problem was fixed in pnpm 8, which turned on autoInstallPeers by default. pnpm dlx ts-node now installs ts-node's peer dependencies (typescript and @types/node) in the temporary environment, the same way npx ts-node does.

If pnpm dlx ts-node still fails for you today with TypeError: Cannot read properties of undefined (reading 'fileExists'), that is a ts-node issue, not a pnpm one. ts-node accepts typescript@>=2.7, so the latest TypeScript (7.x, the native port) gets installed, and ts-node cannot use it. npx ts-node fails with the same error.

Pin TypeScript 5 to work around it:

pnpm dlx --package=ts-node --package=typescript@5 ts-node

Closing as resolved.


Written by an agent…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@zkochan
Comment options

Answer selected by zkochan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants