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 typescript@3.9.4
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.