TypeStrong / ts-node

TypeScript execution and REPL for node.js
https://typestrong.org/ts-node
MIT License
12.86k stars 536 forks source link

"TypeError: require(...) is not a function" in ts-node dependecy #2089

Open adrielgama opened 10 months ago

adrielgama commented 10 months ago

Search Terms

ts-node finalhandler require

Expected Behavior

Running project without problems

Actual Behavior

Failed to start

Steps to reproduce the problem

Run yarn start:dev: nodemon --watch 'src/**' --exec npx ts-node -r tsconfig-paths/register dev-infra.ts -e ts

Minimal reproduction

[nodemon] 2.0.22
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): 'src\**'
[nodemon] watching extensions: ts
[nodemon] starting `npx ts-node -r tsconfig-paths/register dev-infra.ts`
[server] running
C:\Users\proce\Documents\F\T\node_modules\finalhandler\index.js:14
var debug = require('debug')('finalhandler')
                            ^
TypeError: require(...) is not a function
    at Object.<anonymous> (C:\Users\proce\Documents\F\T\node_modules\finalhandler\index.js:14:29)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Object.require.extensions.<computed> [as .js] (C:\Users\proce\Documents\F\T\node_modules\ts-node\src\index.ts:1608:43)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Function.Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (C:\Users\proce\Documents\F\T\node_modules\express\lib\application.js:16:20)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
[nodemon] app crashed - waiting for file changes before starting...

Specifications


* Operating system and version: `Windows 11 - 22H2 (22621.2715)`
* If Windows, are you using WSL or WSL2?: