无法使用本机脚本/错误文件Angular.json迁移Angular [英] Migrating Angular with Nativescript/ Error File angular.json could not be parsed

查看:72
本文介绍了无法使用本机脚本/错误文件Angular.json迁移Angular的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用Nativescript扩展Angular(指令).但是,当我尝试添加nativescript-schematics时(ng add @ nativescript/schematics),我总是收到消息文件angular.json无法解析!":

I try to extend Angular with Nativescript (instructions). But when I try to add nativescript-schematics (ng add @nativescript/schematics) I always get the message "File angular.json could not be parsed!":

+ @nativescript/schematics@0.5.0
updated 1 package and audited 49856 packages in 12.849s
found 9 vulnerabilities (1 low, 5 moderate, 3 high)
  run `npm audit fix` to fix them, or `npm audit` for details
Installed packages for tooling via npm.
 Reading Project Settings
 Project settings:
{
  "root": "",
  "sourceRoot": "src",
  "mainName": "main",
  "mainPath": "src/main.ts",
  "tsConfig": "src/tsconfig.app.json",
  "entryModuleClassName": "AppModule",
  "entryModuleImportPath": "./app/app.module",
  "entryModuleName": "App",
  "entryModulePath": "/src/app/app.module.ts",
  "entryComponentClassName": "AppComponent",
  "entryComponentImportPath": "./app.component",
  "entryComponentName": "App",
  "entryComponentPath": "\\src\\app\\app.component.ts",
  "indexAppRootTag": "app-my-app"
}
Adding @nativescript/schematics to angular.json
File angular.json could not be parsed!

但是我不明白为什么会有错误.我的Angular.json当前看起来像这样:

But I dont understand why there is a error. My Angular.json currently looks like this:

 {
 "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
 "version": 1,
"projects": {

"ch-shuttering-report": {
  "root": "",
  "sourceRoot": "src",
  "projectType": "application",
  "architect": {
    "build": {
      "builder": "@angular-devkit/build-angular:browser",
      "options": {
        "outputPath": "dist",
        "index": "src/index.html",
        "main": "src/main.ts",
        "tsConfig": "src/tsconfig.app.json",
        "polyfills": "src/polyfills.ts",
        "assets": [
          "src/assets",
          "src/favicon.ico"
        ],
        "styles": [
          "node_modules/simplebar/dist/simplebar.css",
          "node_modules/perfect-scrollbar/css/perfect-scrollbar.css",
          "node_modules/angular-calendar/scss/angular-calendar.scss",
          "node_modules/sweetalert2/src/sweetalert2.scss",
          "src/assets/css/demo.css",
          "src/assets/scss/material-dashboard.scss",

          "node_modules/datatables.net-bs4/css/dataTables.bootstrap4.css",
          "node_modules/datatables.net-autofill-bs4/css/autoFill.bootstrap4.css",
          "node_modules/datatables.net-buttons-bs4/css/buttons.bootstrap4.css",
          "node_modules/datatables.net-select-bs4/css/select.bootstrap4.css",
          "node_modules/datatables.net-colreorder-bs4/css/colReorder.bootstrap4.css",
          "node_modules/datatables.net-editor-bs4/css/editor.bootstrap4.css",
          "node_modules/datatables.net-fixedcolumns-bs4/css/fixedColumns.bootstrap4.css",
          "node_modules/datatables.net-fixedheader-bs4/css/fixedHeader.bootstrap4.css",
          "node_modules/datatables.net-keytable-bs4/css/keyTable.bootstrap4.css",
          "node_modules/datatables.net-responsive-bs4/css/responsive.bootstrap4.css",
          "node_modules/datatables.net-rowgroup-bs4/css/rowGroup.bootstrap4.css",
          "node_modules/datatables.net-rowreorder-bs4/css/rowReorder.bootstrap4.css",
          "node_modules/datatables.net-scroller-bs4/css/scroller.bootstrap4.css"

        ],
        "scripts": [
          "node_modules/jquery/dist/jquery.js",
          "node_modules/jquery-validation/dist/jquery.validate.min.js",
          "node_modules/simplebar/dist/simplebar.js",
          "node_modules/popper.js/dist/umd/popper.js",
          "node_modules/bootstrap-material-design/dist/js/bootstrap-material-design.min.js",
          "node_modules/moment/moment.js",
          "node_modules/arrive/src/arrive.js",
          "node_modules/hammerjs/hammer.min.js",
          "node_modules/web-animations-js/web-animations.min.js",
          "node_modules/chartist/dist/chartist.js",
          "node_modules/chartist-plugin-zoom/dist/chartist-plugin-zoom.js",
          "node_modules/twitter-bootstrap-wizard/jquery.bootstrap.wizard.js",
          "node_modules/bootstrap-notify/bootstrap-notify.js",
          "node_modules/nouislider/distribute/nouislider.min.js",
          "node_modules/bootstrap-select/dist/js/bootstrap-select.js",


          "node_modules/jszip/dist/jszip.js",
          "node_modules/pdfmake/build/pdfmake.js",
          "node_modules/pdfmake/build/vfs_fonts.js",
          "node_modules/datatables.net/js/jquery.dataTables.js",
          "node_modules/datatables.net-bs4/js/dataTables.bootstrap4.js",
          "node_modules/datatables.net-editor-bs4/js/dataTables.editor.js",
          "node_modules/datatables.net-editor-bs4/js/editor.bootstrap4.js",
          "node_modules/datatables.net-autofill/js/dataTables.autoFill.js",
          "node_modules/datatables.net-autofill-bs4/js/autoFill.bootstrap4.js",
          "node_modules/datatables.net-buttons/js/dataTables.buttons.js",
          "node_modules/datatables.net-buttons-bs4/js/buttons.bootstrap4.js",
          "node_modules/datatables.net-buttons/js/buttons.colVis.js",
          "node_modules/datatables.net-buttons/js/buttons.flash.js",
          "node_modules/datatables.net-buttons/js/buttons.html5.js",
          "node_modules/datatables.net-buttons/js/buttons.print.js",
          "node_modules/datatables.net-colreorder-bs4/js/colReorder.bootstrap4.js",
          "node_modules/datatables.net-fixedcolumns-bs4/js/fixedColumns.bootstrap4.js",
          "node_modules/datatables.net-fixedheader-bs4/js/fixedHeader.bootstrap4.js",
          "node_modules/datatables.net-keytable-bs4/js/keyTable.bootstrap4.js",
          "node_modules/datatables.net-responsive/js/dataTables.responsive.js",
          "node_modules/datatables.net-responsive-bs4/js/responsive.bootstrap4.js",
          "node_modules/datatables.net-rowgroup-bs4/js/rowGroup.bootstrap4.js",
          "node_modules/datatables.net-rowreorder-bs4/js/rowReorder.bootstrap4.js",
          "node_modules/datatables.net-scroller-bs4/js/scroller.bootstrap4.js",
          "node_modules/datatables.net-select/js/dataTables.select.js",
          "node_modules/datatables.net-select-bs4/js/select.bootstrap4.js",

          "node_modules/fullcalendar/dist/fullcalendar.js",
          "node_modules/bootstrap-tagsinput/dist/bootstrap-tagsinput.js",
          "node_modules/jasny-bootstrap/dist/js/jasny-bootstrap.min.js",
          "node_modules/perfect-scrollbar/dist/perfect-scrollbar.min.js",
          "node_modules/jqvmap/dist/jquery.vmap.min.js",
          "node_modules/jqvmap/dist/maps/jquery.vmap.world.js"
        ]
      },
      "configurations": {
        "production": {
          "optimization": true,
          "outputHashing": "all",
          "sourceMap": false,
          "extractCss": true,
          "namedChunks": false,
          "aot": true,
          "extractLicenses": true,
          "vendorChunk": false,
          "buildOptimizer": true,
          "fileReplacements": [
            {
              "replace": "src/environments/environment.ts",
              "with": "src/environments/environment.prod.ts"
            }
          ]
        }
      }
    },
    "serve": {
      "builder": "@angular-devkit/build-angular:dev-server",
      "options": {
        "browserTarget": "ch-shuttering-report:build"
      },
      "configurations": {
        "production": {
          "browserTarget": "ch-shuttering-report:build:production"
        }
      }
    },
    "extract-i18n": {
      "builder": "@angular-devkit/build-angular:extract-i18n",
      "options": {
        "browserTarget": "ch-shuttering-report:build"
      }
    },
    "test": {
      "builder": "@angular-devkit/build-angular:karma",
      "options": {
        "main": "src/test.ts",
        "karmaConfig": "./karma.conf.js",
        "polyfills": "src/polyfills.ts",
        "tsConfig": "src/tsconfig.spec.json",
        "scripts": [
          "node_modules/jquery/dist/jquery.js",
          "node_modules/popper.js/dist/umd/popper.js",
          "node_modules/bootstrap-material-design/dist/js/bootstrap-material-design.min.js",
          "node_modules/moment/moment.js",
          "node_modules/arrive/src/arrive.js",
          "node_modules/hammerjs/hammer.min.js",
          "node_modules/web-animations-js/web-animations.min.js",
          "node_modules/chartist/dist/chartist.js",
          "node_modules/chartist-plugin-zoom/dist/chartist-plugin-zoom.js",
          "node_modules/twitter-bootstrap-wizard/jquery.bootstrap.wizard.js",
          "node_modules/bootstrap-notify/bootstrap-notify.js",
          "node_modules/nouislider/distribute/nouislider.min.js",
          "node_modules/bootstrap-select/dist/js/bootstrap-select.js",
          "node_modules/datatables/media/js/jquery.dataTables.js",


          "node_modules/jszip/dist/jszip.js",
          "node_modules/pdfmake/build/pdfmake.js",
          "node_modules/pdfmake/build/vfs_fonts.js",
          "node_modules/datatables.net-bs4/js/dataTables.bootstrap4.js",
          "node_modules/datatables.net-editor-bs4/js/dataTables.editor.js",
          "node_modules/datatables.net-editor-bs4/js/editor.bootstrap4.js",
          "node_modules/datatables.net-buttons/js/dataTables.buttons.js",
          "node_modules/datatables.net-buttons-bs4/js/buttons.bootstrap4.js",
          "node_modules/datatables.net-buttons/js/buttons.colVis.js",
          "node_modules/datatables.net-buttons/js/buttons.flash.js",
          "node_modules/datatables.net-buttons/js/buttons.html5.js",
          "node_modules/datatables.net-buttons/js/buttons.print.js",
          "node_modules/datatables.net-colreorder-bs4/js/colReorder.bootstrap4.js",
          "node_modules/datatables.net-fixedcolumns-bs4/js/fixedColumns.bootstrap4.js",
          "node_modules/datatables.net-fixedheader-bs4/js/fixedHeader.bootstrap4.js",
          "node_modules/datatables.net-keytable-bs4/js/keyTable.bootstrap4.js",
          "node_modules/datatables.net-responsive/js/dataTables.responsive.js",
          "node_modules/datatables.net-responsive-bs4/js/responsive.bootstrap4.js",
          "node_modules/datatables.net-rowgroup-bs4/js/rowGroup.bootstrap4.js",
          "node_modules/datatables.net-rowreorder-bs4/js/rowReorder.bootstrap4.js",
          "node_modules/datatables.net-scroller-bs4/js/scroller.bootstrap4.js",
          "node_modules/datatables.net-select/js/dataTables.select.js",
          "node_modules/datatables.net-select-bs4/js/select.bootstrap4.js",



          "node_modules/fullcalendar/dist/fullcalendar.js",
          "node_modules/bootstrap-tagsinput/dist/bootstrap-tagsinput.js",
          "node_modules/jasny-bootstrap/dist/js/jasny-bootstrap.min.js",
          "node_modules/perfect-scrollbar/dist/perfect-scrollbar.min.js",
          "node_modules/jqvmap/dist/jquery.vmap.min.js",
          "node_modules/jqvmap/dist/maps/jquery.vmap.world.js",
          "node_modules/jquery-validation/dist/jquery.validate.min.js"
        ],
        "styles": [
          "node_modules/perfect-scrollbar/css/perfect-scrollbar.css",
          "node_modules/angular-calendar/scss/angular-calendar.scss",
          "node_modules/sweetalert2/src/sweetalert2.scss",
          "src/assets/css/demo.css",
          "src/assets/scss/material-dashboard.scss",

          //BOOTSTRAP4
          "node_modules/datatables.net-bs4/css/dataTables.bootstrap4.css",
          "node_modules/datatables.net-autofill-bs4/css/autoFill.bootstrap4.css",
          "node_modules/datatables.net-buttons-bs4/css/buttons.bootstrap4.css",
          "node_modules/datatables.net-select-bs4/css/select.bootstrap4.css",
          "node_modules/datatables.net-colreorder-bs4/css/colReorder.bootstrap4.css",
          "node_modules/datatables.net-editor-bs4/css/editor.bootstrap4.css",
          "node_modules/datatables.net-fixedcolumns-bs4/css/fixedColumns.bootstrap4.css",
          "node_modules/datatables.net-fixedheader-bs4/css/fixedHeader.bootstrap4.css",
          "node_modules/datatables.net-keytable-bs4/css/keyTable.bootstrap4.css",
          "node_modules/datatables.net-responsive-bs4/css/responsive.bootstrap4.css",
          "node_modules/datatables.net-rowgroup-bs4/css/rowGroup.bootstrap4.css",
          "node_modules/datatables.net-rowreorder-bs4/css/rowReorder.bootstrap4.css",
          "node_modules/datatables.net-scroller-bs4/css/scroller.bootstrap4.css"
        ],
        "assets": [
          "src/assets",
          "src/favicon.ico"
        ]
      }
    },
    "lint": {
      "builder": "@angular-devkit/build-angular:tslint",
      "options": {
        "tsConfig": [
          "src/tsconfig.app.json",
          "src/tsconfig.spec.json"
        ],
        "exclude": []
      }
    }
  }
},

"ch-shuttering-report-e2e": {
  "root": "e2e",
  "sourceRoot": "",
  "projectType": "application",
  "architect": {
    "e2e": {
      "builder": "@angular-devkit/build-angular:protractor",
      "options": {
        "protractorConfig": "./protractor.conf.js",
        "devServerTarget": "ch-shuttering-report:serve"
      }
    },
    "lint": {
      "builder": "@angular-devkit/build-angular:tslint",
      "options": {
        "tsConfig": [
          "e2e/tsconfig.e2e.json"
        ],
        "exclude": []
      }
    }
  }
 }
},
"newProjectRoot": "projects",
"defaultProject": "ch-shuttering-report",
"schematics": {
 "@schematics/angular:component": {
   "prefix": "app",
   "styleext": "scss"
  },
  "@schematics/angular:directive": {
    "prefix": "app"
   } 
 }
}

我使用以下版本:

  • Angular/cli 7.2.1
  • 本国语5.1.0
  • 打字稿3.1.6

我的操作系统是Win10

And my operating system is Win10

谢谢您的帮助

推荐答案

您的 angular.json 文件的内容无效.

在这种情况下,您可以使用任何JSON解析器工具查找问题:

In this case, you can find the issue with any JSON parser tool:

http://json.parser.online.fr/

https://jsonformatter.org/json-parser

将您的 angular.json 文件的内容粘贴到输入中,然后您会看到问题出在哪里.

Paste your angular.json file's content into the input, then you'll see where's the issue.

这篇关于无法使用本机脚本/错误文件Angular.json迁移Angular的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆