ts-node Run Configuration error
I followed the setup guide here https://www.jetbrains.com/help/idea/running-and-debugging-typescript.html#ws_ts_run_debug_server_side but get this Error:
Error: Cannot find module 'ts-node/register'
My configuration looks like this:

I also tried to add tsconfig file to the Application parameters but no luck (--project tsconfig.json).
The script works fine if I run it from iTerm with the globally installed ts-node but not within IntelliJ.
I tried it with a local installation of ts-node and pointing to ./node_modules/ts-node/register but no luck either.
Please sign in to leave a comment.
To run with
--require ts-node/register, you have to install ts-node locally in your project usingnpm i ts-node. You can't require global modules. Once you do this, the error should go awayIt is installed locally in the project:
But still I get:
strange. What is a result of running the same command (
) in the same directory in terminal?
Also, is the
node_modulesin the directory you're working in and not some child directory? This is pure node.js resolution here, not related tots-nodeor the IDE...I used the wrong Working directory. Had to go a level deeper and now everything works as expected.
Thx for your help.