ashish
ashish

Reputation: 23

Typescript is not removed even after reinstalling node

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:

  1. Deleted all node_module instances, and uninstalled node from control panel -> add/remove programs.
  2. Reinstalled node
  3. Checked in cmd:npm view typescript version
  4. I received version as 3.2.2
  5. npm uninstall -g typescript
  6. npm cache verify

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

Answers (3)

hong4rc
hong4rc

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

ashish
ashish

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

Sachin Gupta
Sachin Gupta

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

Related Questions