从Angular 4升级到7时没有angular.json

时间:2018-11-07 15:42:13

标签: angular angular-cli

我按照here所述的所有步骤将我的基本应用程序从4升级到7,但是无论我做什么,我都无法创建angular.json文件。无论运行多少次,运行ng update @angular/cli都无济于事。

我猜测问题是该指南假设我已经有angular-cli.json,但是Angular 4当时没有Angular CLI,所以我还没有angular-cli.json文件。 / p>

我以为我可以尝试使用ng new test-app创建一个新应用并复制angular.json文件以进行挖掘,但是我需要配置很多设置,这意味着存在很大的出错空间这种方法。

有人知道我如何自动生成angular.json吗?

我已经将所有软件包(system.js除外)更新为最新版本,并且我的应用程序运行良好。但是我需要angular.json才能使用CLI发布应用。

这是我的package.json:

"dependencies": {
    "@angular/animations": "^7.0.2",
    "@angular/cli": "^7.0.4",
    "@angular/common": "^7.0.2",
    "@angular/compiler": "^7.0.2",
    "@angular/core": "^7.0.2",
    "@angular/forms": "^7.0.2",
    "@angular/http": "^7.0.2",
    "@angular/platform-browser": "^7.0.2",
    "@angular/platform-browser-dynamic": "^7.0.2",
    "@angular/router": "^7.0.2",
    "@ng-bootstrap/ng-bootstrap": "^4.0.0",
    "angular-crumbs": "^3.0.1",
    "angular2-csv": "^0.2.5",
    "core-js": "^2.5.7",
    "ng2-filter-pipe": "^0.1.10",
    "ngx-clipboard": "^11.1.9",
    "ngx-pagination": "^3.2.1",
    "ngx-window-token": "^1.0.2",
    "rxjs": "6.3.3",
    "systemjs": "0.19.40",
    "zone.js": "^0.8.26"
  }

还有我的SystemJS配置文件:

map: {
    // our app is within the app folder
    'app': 'app',

    // angular bundles
    '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
    '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
    '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
    '@angular/animations': 'npm:@angular/animations/bundles/animations.umd.min.js',
    '@angular/animations/browser': 'npm:@angular/animations/bundles/animations-browser.umd.js',
    '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
    '@angular/platform-browser/animations': 'npm:@angular/platform-browser/bundles/platform-browser-animations.umd.js',
    '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
    '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
    '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
    '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',

    // other libraries
    'ngx-window-token': 'npm:ngx-window-token/bundles/ngx-window-token.umd.min.js',
    'rxjs': 'npm:rxjs',
    'angular-crumbs': 'npm:angular-crumbs/bundles/angular-crumbs.umd.min.js',
    '@ng-bootstrap/ng-bootstrap': 'npm:@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.umd.min.js',
    'ng2-filter-pipe': 'npm:ng2-filter-pipe/dist/index.js',
    'ngx-pagination': 'npm:ngx-pagination/dist/ngx-pagination.umd.js',
    'ngx-clipboard': 'npm:ngx-clipboard/bundles/ngx-clipboard.umd.min.js',
    'angular2-csv': 'npm:angular2-csv/Angular2-csv.js'
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
    app: {
        defaultExtension: 'js',
        meta: {
            './*.js': {
                loader: 'systemjs-angular-loader.js'
            }
        }
    },
    rxjs: {
        main: 'index.js',
        defaultExtension: 'js'
    },
    'rxjs/operators': {
        main: 'index.js',
        defaultExtension: 'js'
    }
}

运行ng update @angular/cli时确实收到以下警告:

C:\MyProject>ng update @angular/cli
UPDATE package.json (2265 bytes)
npm WARN angular-crumbs@3.0.1 requires a peer of @angular/common@>=2.0.0 <7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN angular-crumbs@3.0.1 requires a peer of @angular/core@>=2.0.0 <7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN angular-crumbs@3.0.1 requires a peer of @angular/platform-browser@>=2.0.0 <7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN angular-crumbs@3.0.1 requires a peer of @angular/router@>=2.0.0 <7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN angular-crumbs@3.0.1 requires a peer of reflect-metadata@^0.1.8 but none is installed. You must install peer dependencies yourself.
npm WARN angular2-csv@0.2.5 requires a peer of @angular/core@^2.0.0||^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN angular2-csv@0.2.5 requires a peer of @angular/http@^2.0.0||^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN angular2-csv@0.2.5 requires a peer of rxjs@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\@angular-devkit\core\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

谢谢。

0 个答案:

没有答案