Reputation: 127
I cannot figure out how to make my 'tsc' command working:
tsc
module.js:472
throw err;
^
Error: Cannot find module 'typescript/tsc.js'
at Function.Module._resolveFilename (module.js:470:15)
My 'package.json' has:
"devDependencies": {
"@types/node": "^14.11.2",
"tslib": "^2.0.1",
"typedoc": "^0.19.2",
"typescript": "^4.0.3"
}
And my 'tsconfig.json':
{
"compilerOptions": {
"target": "es6",
"sourceMap": true,
"declaration": true,
"declarationDir": "dist/types",
"strict": true,
"noUnusedLocals": true,
"lib": [
"es2019"
]
},
"include": [
"src"
]
}
No error during 'npm install'.
When I check up the 'node_modules' folder, typescript exists and the 'tsc.js' file exists within the 'typescript/lib' directory.
node --version: 12.18.4
npm --version: 6.14.6
system: Ubuntu 16.04 LTS
I have tried many of the solution proposed for a similar issue without success:
None of the above gets me any result. Thank you very much for your help.
Upvotes: 5
Views: 14527
Reputation: 3936
To make the tsc --version
command working, try to install using npm install -g typescript
command. It installs the typescript globally.
Upvotes: 2
Reputation: 127
For those who gets stuck with that, the command that should be run with your local tsc is:
npx tsc
Upvotes: 4