Search code examples
androidnativescriptcircleci

Nativescript 5.4.0 build fails with "couldn't find sbg-bindings.txt"


Nativescript released 5.4.0 where hmr is enabled by default. After upgrade to 5.4.0, my nativescript cloud build as well as local build started breaking with following error message:

Exception in thread "main" java.io.IOException: Couldn't find '/home/circleci/repo/platforms/android/build-tools/sbg-bindings.txt' bindings input file. Most probably there's an error in the JS Parser execution. You can run JS Parser with verbose logging by executing "node '/home/circleci/repo/platforms/android/build-tools/jsparser/js_parser.js' enableErrorLogging".
    at org.nativescript.staticbindinggenerator.Generator.generateBindings(Generator.java:126)
    at org.nativescript.staticbindinggenerator.Generator.writeBindings(Generator.java:97)
    at org.nativescript.staticbindinggenerator.Main.main(Main.java:48)

The following is a relevant code snippet which has changed.

package.json

{
  nativescript: {
    id: "com.sample.drawer.app",
    tns-ios: {
      version: "5.4.0"
    },
    tns-android: {
      version: "5.4.0"
    }
  },
  description: "NativeScript Application",
  license: "SEE LICENSE IN <your-license-filename>",
  repository: "<fill-your-repository-here>",
  scripts: {
    lint: "tslint "
    app/**/*.ts
    "",
    tsc: "tsc"
  },
  dependencies: {
    nativescript-theme-core: "~1.0.4",
    nativescript-ui-sidedrawer: "~5.0.0",
    rxjs: "~6.2.0",
    tns-core-modules: "^5.4.1"
  },
  devDependencies: {
    nativescript-dev-sass: "~1.6.0",
    nativescript-dev-typescript: "~0.7.0",
    nativescript-dev-webpack: "~0.18.0",
    tslint: "~5.11.0",
    typescript: "~3.2.2"
  },
  readme: "NativeScript Application"
}

nsconfig.json

{
  "useLegacyWorkflow": false
}

When useLegacyWorkflow is set to true, the build works fine but I need to move away from legacy workflow. If required complete logs can be found at https://circleci.com/gh/rakeshgirase/CloudBuild/106. Earlier successful build is which uses legacyWorkflow and passes https://circleci.com/gh/rakeshgirase/CloudBuild/103.

Since I have not made any changes to the code, it seems something to do with the environmental settings.

Any thoughts?


Solution

  • The solution was the following:

    From the project root run

    ./node_modules/.bin/update-ns-webpack --deps --configs
    

    This updates package.json and node_modules.

    Then I removed the following folders.

    node_modules, platform, hooks
    

    And do a clean run

    tns run android