vscode-code-runner: /bin/sh: ts-node: command not found

I have already install ts-node.

I did not do any setting up.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 16 (4 by maintainers)

Most upvoted comments

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"
}

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.

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.

npm install -g ts-node

npm install -g tsx

and then:

“code-runner.executorMap”: { “typescript”: “tsx”, “javascript”: “node” }