Skip to content

Cannot find module 'typescript' when using npx ts-node #1426

@janpio

Description

@janpio

We have been using npx ts-node to run a specific script for quite some while now, and with update 10.2.0 that script started to fail.

Expected Behavior

Script works.

Actual Behavior

Cannot find module 'typescript'
Require stack:
- /home/runner/.npm/_npx/2763/lib/node_modules/ts-node/dist/index.js
- /home/runner/.npm/_npx/2763/lib/node_modules/ts-node/dist/repl.js
- /home/runner/.npm/_npx/2763/lib/node_modules/ts-node/dist/bin.js

Steps to reproduce the problem

prisma/ecosystem-tests#1982

Minimal reproduction

Specifications

  • ts-node version: 10.2.0
  • node version: 12.22.4
  • TypeScript version: -
  • tsconfig.json, if you're using one:
{
  "compilerOptions": {
    "esModuleInterop": true,
    "lib": ["ESNext", "dom"]
  }
}
  • Operating system and version: Ubuntu 20.04.2 LTS (GH Actions)
  • If Windows, are you using WSL or WSL2?:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions