Yesterday works but today I have this error. I reinstall globally and local
npm i --save-dev typescript
npm i -g typescript
and lower version
npm install -g [email protected]
remove from directory AppData\Roaming\npm but this doesnt work. remove node_modules too
tsconfig
{
"compilerOptions": {
"target": "es5",
"removeComments": true,
"outFile": "app.js",
"lib": ["es2017", "dom"]
},
"files":[
"app.ts",
"inter.ts",
]
}
I run command
npx ts
and then I had got error :
Cannot find module 'typescript'
$ npm -v
6.13.4
$ node -v
v12.16.1
Sometimes you may need to link the package manually, as it may conflict if there's an existing node_modules already.
Try this:
npm link typescript
An alternative solution would be to delete the node_modules folder and then run npm install again.
Add "typescript": "~4" to package.json's devDependencies works for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With