Reputation: 23
While working on Angular 5 project, I got the following error on compilation :
@angular/[email protected] requires typescript@'>=2.4.2 <2.7.0' but 2.7.2 was found instead.
Using this version can result in undefined behaviour and difficult to debug problems.
Please run the following command to install a compatible version of TypeScript.
npm install typescript@'>=2.4.2 <2.7.0'
To disable this warning run "ng set warnings.typescriptMismatch=false".
To fix this error did the following:
Still typescript is not removed from npm. Can some one help me uninstall typescript completely? Been stuck on this for 2 days now.
Upvotes: 0
Views: 1655
Reputation: 4113
Check following step:
You call @angular/compiler-cli
in global or local(just one folder), you need install typescript
same.
Install typescript
match '>=2.4.2 <2.7.0'
, example : [email protected]
, local or global with -g
.
Try close your cmd
, reopen it (if typescript install global, cmd don't know it change if you don't reopen).
Check your eviroment variable NODE_PATH
, if it exist, go to that folder to remove module in that.
To check NODE_PATH
, type in your cmd : echo %NODE_PATH%
Upvotes: 0
Reputation: 23
It seems there is a small mistake in compiler log: Please run the following command to install a compatible version of TypeScript.
npm install typescript@'>=2.4.2 <2.7.0'
should be
npm install typescript@">=2.4.2 <2.7.0"
Upvotes: 1
Reputation: 5321
Maybe there is a mismatch in your package json. Update the typescript version as suggested and update package.json
run:
npm install typescript@'>=2.4.2 <2.7.0' --save
Upvotes: 0