Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'ts-node' is not recognized as an internal or external command, operable program or batch file

I'm getting error in my Vs Code terminal and command prompt that 'ts-node' is not recognized as an internal or external command, operable program or batch file. while i'm trying the start command in the terminal npm run dev and i have added my package.json file also.

{ "name": "tsnode", "version": "1.0.0", "description": "ts-node experiment.", "scripts": {     "dev": "nodemon --exec 'ts-node --cache-directory .tscache' ./server.ts",     "start": "ts-node --fast ./server.ts" }, "author": "Mugesh", "license": "ISC", "dependencies": {     "@types/body-parser": "^1.16.3",     "@types/chalk": "^0.4.31",     "@types/express": "^4.0.35",     "@types/node": "^7.0.18",     "body-parser": "^1.17.1",     "chalk": "^1.1.3",     "express": "^4.15.2",     "nodemon": "^1.11.0",     "ts-node": "^3.0.4",     "typescript": "^2.3.4" } 

}

like image 541
Mugesh Avatar asked Jun 26 '17 16:06

Mugesh


People also ask

How do I run a ts-node file?

We can use the ts-node package to execute TypeScript files from the command line. Install it with npm or other package manager. After that, simply execute the TypeScript files with the command: ts-node filename.

Should I install ts-node globally?

You need to install ts-node as global. No need to install globally.

What is ts-node command?

ts-node is a TypeScript execution engine and REPL for Node. js. It JIT transforms TypeScript into JavaScript, enabling you to directly execute TypeScript on Node. js without precompiling. This is accomplished by hooking node's module loading APIs, enabling it to be used seamlessly alongside other Node.


1 Answers

You need to install ts-node as global

npm install -g ts-node 

More information

https://github.com/TypeStrong/ts-node

like image 184
Sam Quinn Avatar answered Oct 02 '22 22:10

Sam Quinn