7

Nativescript 5 is out and I am trying to update the tns version. Currently it tns --version shows as 4.3.2.

I followed all the steps in https://docs.nativescript.org/releases/upgrade-instructions but it still gives me the version as 4.3.2.

How can I upgrade nativescript-cli so that tns --version shows me the latest version.

Manoj
  • 21,753
  • 3
  • 20
  • 41
Rakesh
  • 4,004
  • 2
  • 19
  • 31

2 Answers2

14

I did following to reflect the update Nativescript cli. You should only follow this when npm install -g nativescript@latest doesn't reflect update the cli. You can check that using tns --version before and after.

  1. Uninstall current nativescript cli using npm uninstall -g nativescript
  2. Delete the existing tns command manuall if it still exist on your machine.
  3. Install the latest Nativescript cli using npm install -g nativescript@latest
  4. tns --version should now show the latest version.
Rakesh
  • 4,004
  • 2
  • 19
  • 31
3

How I did update tns:

  1. run cmd as administrator (you using windows as i read above in one of comments)
  2. (optional) run npm view nativescript version to check latest aveilable on npm
  3. run tns install -g nativescript
  4. restart cmd
  5. run tns --version - hopefully you will see 5.0.0

hope this helps.

Btw, you might need to run some additional commands for your projects if you already added platforms tns platform remove {platform}

tns platform add {platform}, where {platform} is android or ios

...also, you might run tns doctor after upgrading as I noticed it broke my other components like choco.

Msmkt
  • 1,261
  • 16
  • 24
  • 2
    I think u meant ```npm install -g nativescript``` instead of ```tns install -g nativescript``` – Yaro Oct 04 '19 at 10:04