Nativescript: How to install a specific version of NativeScript?

Created on 9 Oct 2019  路  3Comments  路  Source: NativeScript/NativeScript

I tried -

npm remove -g nativescript
npm install -g nativescript@version --- 5.4.0

Doesnt seem to work?

No valid versions available for 5.4.0

Also tried -
tns update 5.4.0 once latest NativeScript is installed. But says;

This project is not compatible with the current NativeScript version and cannot be updated. Use "tns migrate" to make your project compatible.

I can't compile/run my app anymore after migrating/installing v6.

question

Most helpful comment

@sputn1k the command npm i -g nativescript will install the NativeScript CLI. It won't update/migrate your existing project. However, once you have installed a specific version of the CLI, you can use it to create new projects with the related versions.

For example

npm uninstall -g nativescript
npm i -g [email protected]
tns --version // will output 5.4.0

One, you have the wanted version of the CLI you can create a project that uses the core dependencies (e.g., runtime, modules) that were compatible with that CLI version

tns create my-app --tsc

and the generated pckage.json will look like this

{
  "nativescript": {
    "id": "org.nativescript.myapp",
    "tns-android": {
      "version": "5.4.0"
    },
    "tns-ios": {
      "version": "5.4.2"
    }
  },
  "main": "app.js",
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "repository": "<fill-your-repository-here>",
  "dependencies": {
    "nativescript-theme-core": "~1.0.4",
    "tns-core-modules": "~5.4.0"
  },
  "devDependencies": {
    "nativescript-dev-typescript": "~0.10.0",
    "nativescript-dev-webpack": "~0.24.0"
  },
  "gitHead": "8c1a4866a66daab09bf5ef8e5a96472687192373",
  "readme": "NativeScript Application"
}

All 3 comments

@sputn1k the command npm i -g nativescript will install the NativeScript CLI. It won't update/migrate your existing project. However, once you have installed a specific version of the CLI, you can use it to create new projects with the related versions.

For example

npm uninstall -g nativescript
npm i -g [email protected]
tns --version // will output 5.4.0

One, you have the wanted version of the CLI you can create a project that uses the core dependencies (e.g., runtime, modules) that were compatible with that CLI version

tns create my-app --tsc

and the generated pckage.json will look like this

{
  "nativescript": {
    "id": "org.nativescript.myapp",
    "tns-android": {
      "version": "5.4.0"
    },
    "tns-ios": {
      "version": "5.4.2"
    }
  },
  "main": "app.js",
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "repository": "<fill-your-repository-here>",
  "dependencies": {
    "nativescript-theme-core": "~1.0.4",
    "tns-core-modules": "~5.4.0"
  },
  "devDependencies": {
    "nativescript-dev-typescript": "~0.10.0",
    "nativescript-dev-webpack": "~0.24.0"
  },
  "gitHead": "8c1a4866a66daab09bf5ef8e5a96472687192373",
  "readme": "NativeScript Application"
}

:wave: @sputn1k, we use the issue tracker exclusively for bug reports and feature requests. However, this issue appears to be a support request. Please, use Stackoverflow to get help.

@NickIliev Thanks I'll try that out cheers

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kn9ts picture kn9ts  路  3Comments

hshristov picture hshristov  路  3Comments

nirsalon picture nirsalon  路  3Comments

rLoka picture rLoka  路  3Comments

Leo-lay picture Leo-lay  路  3Comments