I have already install ts-node.
I did not do any setting up.
Is ts-node in your PATH environment variable, and have you restarted VS Code?
@formulahendry ts-node in node_modules/.bin/ts-node. And, I use command + q quit vscode and restarted. The problem still there
You need either put ts-node in your PATH environment variable, or set the path of ts-node in File->Preference->Settings:
"code-runner.executorMap": {
"typescript": "node_modules/.bin/ts-node"
}
@formulahendry
ts-node installed globally.code-runner look up ts-node locally, if local ts-node is not existed, then look up global one.Since Code Runner supports several languages and user is able to customize the path, we will not support this feature. You could udpate executorMap per your need.
is it possible for code runner supports the use of npx which automatically loads the binaries from local node_modules, and bundles it with the locally installed ts-node automatically so that we don't need to add anything to the user setting/ workspace setting?
@HaoyangFan I am not familiar with npx. It is loaded in .bashrc? If it is, you could run the code in terminal which will load .bashrc: "code-runner.runInTerminal": true
My solution is:
"code-runner.executorMap": {
"typescript": "node -r ts-node/register",
"javascript": "node"
}
I think it's better than the solution @formulahendry provided. You don't need care about the path like this: ${whatever PATH}/node_modules/.bin/ts-node. Because the PATH often changes.
you must install ts-node global, u can try again
Most helpful comment
You need either put ts-node in your PATH environment variable, or set the path of ts-node in
File->Preference->Settings: