Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update nativescript cli

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.

like image 203
Rakesh Avatar asked Nov 03 '18 20:11

Rakesh


2 Answers

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.
like image 165
Rakesh Avatar answered Nov 08 '22 10:11

Rakesh


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.

like image 3
Msmkt Avatar answered Nov 08 '22 08:11

Msmkt