/usr/local/lib/node_modules/ts-node/src/index.ts:857
const diagnosticText = formatDiagnostics(diagnostics, diagnosticHost);
TypeError: formatDiagnostics is not a function
at createTSError (/usr/local/lib/node_modules/ts-node/src/index.ts:857:28)
at reportTSError (/usr/local/lib/node_modules/ts-node/src/index.ts:863:19)
at createFromPreloadedConfig (/usr/local/lib/node_modules/ts-node/src/index.ts:874:36)
at phase4 (/usr/local/lib/node_modules/ts-node/src/bin.ts:543:44)
at bootstrap (/usr/local/lib/node_modules/ts-node/src/bin.ts:95:10)
at main (/usr/local/lib/node_modules/ts-node/src/bin.ts:55:10)
at Object.<anonymous> (/usr/local/lib/node_modules/ts-node/src/bin.ts:800:3)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
And I don't know how to fix it. Please, help me!!! My node version is 18.18, typescript version is 5.3.3, ts-node is 10.9.2
Or the issue depends on the versions of languages?
As the similar issue states, your development environment seems to be broken in some way. Personally, I couldn't recreate this behavior with the matching stack:
The ts-node docs states that any error except
TSErrorcome from node and can be caused by bugs in your code or configuration.Here are couple of possible solutions:
Try different version of node (you can use
nvm), especially if you have multiple environments installedReview your code and configuration files
Remove
typescriptandts-nodefromnode_modulesdirectory and try: