Nativescript-cli: Upgraded to TNS 4.1.0. Unable to build platforms. Error '--allowJS' is not set.

Created on 5 Jun 2018  Â·  6Comments  Â·  Source: NativeScript/nativescript-cli

_From @shivapersad on June 4, 2018 19:55_

Did you verify this is a real problem by searching the NativeScript Forum and the other open issues in this repo? Yes

Which platform(s) does your issue occur on?

Both

"nativescript": {
    "id": "org.ngccng.cngApp",
    "tns-ios": {
      "version": "4.1.0"
    },
    "tns-android": {
      "version": "4.1.1"
    }
  },
  "dependencies": {
    "@angular/animations": "~4.1.0",
    "@angular/common": "~4.1.0",
    "@angular/compiler": "~4.1.0",
    "@angular/core": "~4.1.0",
    "@angular/forms": "~4.1.0",
    "@angular/http": "~4.1.0",
    "@angular/platform-browser": "~4.1.0",
    "@angular/router": "~4.1.0",
    "nativescript-angular": "~3.0.0",
    "nativescript-drop-down": "3.1.3",
    "nativescript-fancyalert": "^1.1.2",
    "nativescript-iqkeyboardmanager": "^1.1.0",
    "nativescript-mapbox": "2.4.0",
    "nativescript-phone": "^1.3.1",
    "nativescript-theme-core": "~1.0.2",
    "reflect-metadata": "~0.1.8",
    "rxjs": "~5.3.0",
    "tns-core-modules": "^4.1.0",
    "validator": "^6.2.1",
    "zone.js": "~0.8.2"
  },
  "devDependencies": {
    "babel-traverse": "^6.26.0",
    "babel-types": "6.25.0",
    "babylon": "6.17.4",
    "lazy": "1.0.11",
    "nativescript-dev-typescript": "~0.4.0",
    "typescript": "~2.2.1"
  }
}

I updated my version of TNS from 3.3.0 to 4.1.0. I removed my iOS and Android platforms. I ran "tns update" in the root folder which updated the application. When I run "tns build android" or "tns build ios" I get the following error message in my console:

node_modules/tns-core-modules/ui/styling/gradient.d.ts(7,25): error TS6143: Module '../../css/parser' was resolved to '/Users/shivapersad/cngProject/cngApp/node_modules/tns-core-modules/css/parser.js', but '--allowJs' is not set.

TypeScript compiler failed with exit code 1**

I checked the file being displayed in the error message but I am not seeing the '--allowJs' flag in the code. Any assistance is appreciated. Thanks.

_Copied from original issue: NativeScript/NativeScript#5909_

question

Most helpful comment

In my case I had some outdated dependencies, I just had to update typescript to 2.7.* and it works normally

All 6 comments

_From @arielnmz on June 4, 2018 22:12_

This happens to me too. Also tns doctor says:

âš  Update available for component tns-android. Your current version is 4.0.1 and the latest available version is 4.1.1.

When 4.1.1 is in fact installed:

npm view tns-android 

[email protected] | Proprietary | deps: none | versions: 581
NativeScript Runtime for Android
https://github.com/NativeScript/android-runtime#readme

dist
.tarball https://registry.npmjs.org/tns-android/-/tns-android-4.1.1.tgz
.shasum: bd4c4cba333f556d225a3849a9cfe86c42db8d55
.integrity: sha512-g4+tD5klSdGRvhLTT/K20DaAftT3SUuWeDh167snAwrbtDkhDn6djoU+FLhWO+HOzoVPb7/nYiGVyXqbxtpjTw==
.unpackedSize: 49.4 MB

maintainers:
- hdeshev <[email protected]>
- panayot.cankov <[email protected]>
- tns-bot <[email protected]>

dist-tags:
latest: 4.1.1               rc: 4.1.1-rc-2018-05-28-03  
next: 4.2.0-2018-06-04-07   

published 4 days ago by tns-bot <[email protected]>

_From @jogboms on June 5, 2018 5:1_

@shivapersad et @arielnmz I believe you might need to update you {N} Angular dependencies to v6.

_From @tsonevn on June 5, 2018 10:11_

HI all.
As @jogboms says, you should upgrade nativescript-angular and all other angular dependances. You can check the attached package.json file.

{
    "description": "NativeScript Application",
    "license": "SEE LICENSE IN <your-license-filename>",
    "readme": "NativeScript Application",
    "repository": "<fill-your-repository-here>",
    "nativescript": {
        "id": "org.nativescript.testNG"
    },
    "dependencies": {
        "@angular/animations": "~6.0.0",
        "@angular/common": "~6.0.0",
        "@angular/compiler": "~6.0.0",
        "@angular/core": "~6.0.0",
        "@angular/forms": "~6.0.0",
        "@angular/http": "~6.0.0",
        "@angular/platform-browser": "~6.0.0",
        "@angular/platform-browser-dynamic": "~6.0.0",
        "@angular/router": "~6.0.0",
        "nativescript-angular": "~6.0.0",
        "nativescript-theme-core": "~1.0.4",
        "reflect-metadata": "~0.1.8",
        "rxjs": "~6.1.0",
        "tns-core-modules": "~4.1.0",
        "zone.js": "^0.8.26"
    },
    "devDependencies": {
        "nativescript-dev-typescript": "~0.7.0",
        "typescript": "~2.7.2"
    }
}

Also make sure that your are using latest NativeScript CLI 4.2(tns --version). Before rebuilding also delete node_modules, platforms, package-lock.json files.

@NickIliev I updated my package.json file with the dependencies above and my Nativescript project works fine. Thanks for your assistance in resolving my issue.

In my case I had some outdated dependencies, I just had to update typescript to 2.7.* and it works normally

I updated typescript and the error is gone.

{
"description": "NativeScript Application",
"license": "SEE LICENSE IN ",
"readme": "NativeScript Application",
"repository": "",
"nativescript": {
"__id": "XXXXXXXXXXX",
"id": "XXXXXXXXXXX",
"tns-ios": {
"version": "3.4.1"
},
"tns-android": {
"version": "4.2.0"
}
},
"scripts": {
"lint": "tslint \"app/*/.ts\""
},
"dependencies": {
"moment": "^2.21.0",
"nativescript-theme-core": "1.0.4",
"nativescript-toast": "^1.4.6",
"tns-core-modules": "^4.2.1"
},
"devDependencies": {
"babel-traverse": "6.26.0",
"babel-types": "6.26.0",
"babylon": "6.18.0",
"lazy": "1.0.11",
"nativescript-dev-sass": "^1.3.2",
"nativescript-dev-typescript": "^0.7.4",
"node-sass": "4.5.3",
"tslint": "5.7.0",
"typescript": "^3.1.3"
}
}

Was this page helpful?
0 / 5 - 0 ratings