You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I run my typescript (served via npx) through ts-node so I don't have to maintain a build.
For an example of how I had this working pre-ESM, see this gist.
Expected Behavior
The program runs without error. In the case of the linked gist, it runs hello.ts, printing "Hello, world!".
Actual Behavior
$ npx https://gist.github.com/brianjenkins94/d73578d7439427a59df28c1bc751e02d
Need to install the following packages:
gist:d73578d7439427a59df28c1bc751e02d
Ok to proceed? (y) y
> node --experimental-specifier-resolution=node --loader=/Users/bjenkins/.npm/_npx/caa40e90fbe6bfad/ts-node/esm /Users/bjenkins/.npm/_npx/caa40e90fbe6bfad/node_modules/sampleThatReproducesTheIssue/hello.ts
(node:35543) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
node:internal/errors:464
ErrorCaptureStackTrace(err);
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/bjenkins/.npm/_npx/caa40e90fbe6bfad/ts-node/esm' imported from /Users/bjenkins/Desktop/foo/
at new NodeError (node:internal/errors:371:5)
at finalizeResolution (node:internal/modules/esm/resolve:405:11)
at moduleResolve (node:internal/modules/esm/resolve:932:10)
at defaultResolve (node:internal/modules/esm/resolve:1044:11)
at ESMLoader.resolve (node:internal/modules/esm/loader:422:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:222:40)
at ESMLoader.import (node:internal/modules/esm/loader:276:22)
at initializeLoader (node:internal/process/esm_loader:74:49)
at loadESM (node:internal/process/esm_loader:87:11)
at runMainESM (node:internal/modules/run_main:47:21) {
code: 'ERR_MODULE_NOT_FOUND'
}
(@cspotcode This is from a while back on Discord)
Search Terms
Context
I run my typescript (served via
npx) throughts-nodeso I don't have to maintain a build.For an example of how I had this working pre-ESM, see this gist.
Expected Behavior
The program runs without error. In the case of the linked gist, it runs
hello.ts, printing "Hello, world!".Actual Behavior
Steps to reproduce the problem
Minimal reproduction
https://gist.github.com/brianjenkins94/d73578d7439427a59df28c1bc751e02d
Specifications
tsconfig.json