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

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

有什么想法吗?

最佳答案

解决方案如下:

从项目根目录运行

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


这将更新package.json和node_modules。

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

node_modules, platform, hooks


并进行干净的运行

tns run android

关于android - Nativescript 5.4.0构建失败,并显示“找不到sbg-bindings.txt”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56379865/

10-12 04:03