簡體   English   中英

安裝“single-spa”后出現錯誤,無法理解問題

[英]Getting error after install `single-spa`, not able to understand the issue

在我將 angular 從 8 升級到 9 后,我實現了single-spa 。當我通過運行命令yarn serve:single-spa:ibo開始運行應用程序時,出現以下錯誤。

$ ng s --project ibo --disable-host-check --port 4200 --deploy-url http://localhost:4200/ --live-reload false
As a forewarning, we are moving the CLI npm package to "@angular/cli" with the next release,
which will only support Node 6.9 and greater. This package will be officially deprecated
shortly after.

To disable this warning use "ng set --global warnings.packageDeprecation=false".

The option '--project' is not registered with the serve command. Run `ng serve --help` for a list of supported options.
The option '--disable-host-check' is not registered with the serve command. Run `ng serve --help` for a list of supported options.
Cannot read property 'config' of null
TypeError: Cannot read property 'config' of null
    at Class.run (C:\722333\AOS.Setup\Source\UI\node_modules\angular-cli\tasks\serve.js:22:61)
    at C:\722333\AOS.Setup\Source\UI\node_modules\angular-cli\commands\serve.run.js:22:22
    at processTicksAndRejections (internal/process/task_queues.js:85:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

無法理解問題。 有人請幫幫我嗎? 這是我的angular.json文件:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "ibo": {
      "root": "src",
      "sourceRoot": "src",
      "projectType": "application",
      "prefix": "",
      "schematics": {
        "@ngrx/schematics:component:component": {
          "styleext": "scss"
        }
      },
      "architect": {
        "build": {
          "builder": "@angular-builders/custom-webpack:browser",
          "options": {
            "outputPath": "dist/ibo",
            "index": "src/index.html",
            "main": "src\\main.single-spa.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.app.json",
            "assets": [
              "src/favicon.ico",
              "src/assets",
              "src/web.config"
            ],
            "stylePreprocessorOptions": {
              "includePaths": [
                "node_modules/simplebar",
                "node_modules/bootstrap",
                "node_modules/angular-calendar",
                "node_modules/@ibo/shared-lib",
                "src/styles",
                "src/assets/js/datepicker.min.css"
              ]
            },
            "scripts": [
              "node_modules/popper.js/dist/umd/popper.min.js",
              "node_modules/jquery/dist/jquery.min.js",
              "node_modules/bootstrap/dist/js/bootstrap.min.js",
              "src/assets/js/datepicker.min.js"
            ],
            "styles": [
              "./node_modules/@ibo/ibo-shared-lib/styles/styles.scss",
              "./node_modules/quill/dist/quill.core.css",
              "./node_modules/quill/dist/quill.snow.css"
            ],
            "customWebpackConfig": {
              "path": "src\\extra-webpack.config.js"
            }
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "none",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "10mb",
                  "maximumError": "50mb"
                }
              ]
            },
            "insprint": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.insprint.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "none",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": false,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": false
            },
            "qa": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.qa.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "none",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": false,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": false
            },
            "sit": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.sit.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "none",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": false,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": false
            }
          }
        },
        "serve": {
          "builder": "@angular-builders/custom-webpack:dev-server",
          "options": {
            "browserTarget": "ibo:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "ibo:build:production"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "ibo:build"
          }
        },
        "test": {
          "builder": "@angular-builders/jest:run",
          "options": {
            "main": "src/test.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "configPath": "./jest.config.js",
            "styles": [],
            "scripts": [],
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ]
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "tsconfig.app.json",
              "tsconfig.spec.json",
              "e2e/tsconfig.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },
    "ibo-e2e": {
      "root": "e2e/",
      "projectType": "application",
      "prefix": "",
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "e2e/protractor.conf.js",
            "devServerTarget": "ibo:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "ibo:serve:production"
            }
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": "e2e/tsconfig.e2e.json",
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    }
  },
  "defaultProject": "ibo",
  "cli": {
    "defaultCollection": "@ngrx/schematics"
  }
}

ng --version之后,您應該看到如下內容

Your global Angular CLI version (10.0.0-next.6) is greater than your local
version (9.1.6). The local Angular CLI version is used.

按照說明安裝最新的穩定 angular/cli

這取決於您擁有的舊版本,請嘗試如下

npm uninstall -g angular-cli
npm uninstall -g @angular/cli
npm install -g @angular/cli@latest 

ng --version不僅應該給出單行,而且應該如下

Angular CLI: 9.1.6
Node: 10.16.0
OS: win32 x64

Angular: 9.1.7
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.6
@angular-devkit/build-angular     0.901.6
@angular-devkit/build-optimizer   0.901.6
@angular-devkit/build-webpack     0.901.6
@angular-devkit/core              9.1.6
@angular-devkit/schematics        9.1.6
@angular/cli                      9.1.6
@angular/fire                     6.0.0
@ngtools/webpack                  9.1.6
@schematics/angular               9.1.6
@schematics/update                0.901.6
rxjs                              6.5.5
typescript                        3.8.3
webpack                           4.42.0

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM