I am trying to set up a basic nest.js app.
main.js is in the src folder. I run this command:
npx ts-node-dev src/main.ts
I get this error:
Cannot find module 'typescript'
Require stack:
- /home/yilmaz/.npm/_npx/429895/lib/node_modules/ts-node-dev/lib/index.js
- /home/yilmaz/.npm/_npx/429895/lib/node_modules/ts-node-dev/lib/bin.js
I installed typescript globally, close the terminal and restart it. run tsc -v
and I get "Version 4.3.5" but the error is not resolved.
This is the tsconfig.json:
{
"compilerOptions": {
"module": "commonjs",
"target": "es2017",
"experimentalDecorators": true,
"emitDecoratorMetadata": true
}
}
After I installed typescript, I recreated this file with tsc --init
and enabled
"experimentalDecorators": true,
"emitDecoratorMetadata": true
npm link typescript
? – Hankynode.js 16
or 2) install and run both ts and ts-node-dev on the flynpx -p typescript -p ts-node-dev ts-node-dev src/main.ts
– Victoirnpx -p typescript -p ts-node-dev ts-node-dev src/main.ts
worked me, after installingrxjs
. – Gladisgladney