Nativescript 5.4.0构建失败,找不到sbg-bindings.txt

时间:2019-05-30 14:05:49

标签: android nativescript circleci

Nativescript发布了5.4.0,默认情况下启用了hmr。升级到5.4.0后,我的nativescript云版本以及本地版本开始出现以下错误消息:

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)

以下是相关代码段已更改。 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
}

当useLegacyWorkflow设置为true时,构建可以正常工作,但是我需要远离传统工作流程。如果需要,可以在https://circleci.com/gh/rakeshgirase/CloudBuild/106上找到完整的日志。较早的成功构建是使用legacyWorkflow并传递https://circleci.com/gh/rakeshgirase/CloudBuild/103

由于我没有对代码进行任何更改,因此似乎与环境设置有关。

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

解决方案如下:

从项目根目录运行

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

这将更新package.json和node_modules。

然后我删除了以下文件夹。

node_modules, platform, hooks

然后干净运行

tns run android