代码之家  ›  专栏  ›  技术社区  ›  Guerrilla

角度看错字体版本

  •  1
  • Guerrilla  · 技术社区  · 4 年前

    当我跑的时候 ng build 我得到以下错误:

    角度编译器中的错误要求TypeScript>=3.4.0和<3.6.0,但找到的却是3.7.4。

    但是在我的 package.json ,我已经定义了 "typescript": "^3.5.3"

    我在项目的档案中发现了 3.7.4 它不会出现在任何地方,那么为什么Angular CLI认为这是指定的版本?

    我正在使用节点12.13.0。

    这是我的全部 包.json :

    {
      "name": "my-app",
      "version": "0.0.0",
      "scripts": {
        "postinstall": "npm run build",
        "ng": "ng",
        "dev": "ng build --aot --watch",
        "dtos": "tsd-ref && ts-ref",
        "build": "ng build --prod",
        "publish": "npm run build",
        "lint": "ng lint",
        "test": "ng test",
        "e2e": "ng e2e"
      },
      "private": true,
      "dependencies": {
        "@angular/animations": "^8.2.14",
        "@angular/common": "^8.2.14",
        "@angular/compiler": "^8.2.14",
        "@angular/core": "^8.2.14",
        "@angular/forms": "^8.2.14",
        "@angular/http": "^7.2.15",
        "@angular/platform-browser": "^8.2.14",
        "@angular/platform-browser-dynamic": "^8.2.14",
        "@angular/router": "^8.2.14",
        "@servicestack/angular": "0.0.8",
        "@servicestack/client": "^1.0.31",
        "bootstrap": "^4.4.1",
        "core-js": "^3.6.1",
        "rxjs": "^6.5.4",
        "zone.js": "^0.9.1"
      },
      "devDependencies": {
        "@angular-devkit/build-angular": "^0.803.21",
        "@angular/cli": "^8.3.21",
        "@angular/compiler-cli": "^8.2.14",
        "@angular/language-service": "^8.2.14",
        "@types/jasmine": "^3.5.0",
        "@types/jasminewd2": "^2.0.8",
        "@types/node": "^12.12.22",
        "codelyzer": "^5.2.1",
        "gulp": "^4.0.2",
        "jasmine-core": "^3.5.0",
        "jasmine-spec-reporter": "~4.2.1",
        "karma": "^4.4.1",
        "karma-chrome-launcher": "~3.0.0",
        "karma-coverage-istanbul-reporter": "^2.1.1",
        "karma-jasmine": "^2.0.1",
        "karma-jasmine-html-reporter": "^1.5.1",
        "protractor": "^5.4.2",
        "ts-node": "^8.5.4",
        "tslint": "^5.20.1",
        "typescript": "^3.5.3"
      }
    }
    
    1 回复  |  直到 4 年前
        1
  •  1
  •   mythz    4 年前

    npm semver docs 解释不同运算符的含义,例如。 ^Caret Ranges 允许升级到下一个主要版本。

    你可以用 ~Tilde Ranges 而是允许修补程序级别更改:

    "typescript": "~3.5.3"
    

    或指定使用 精确版本 您应该指定版本号(假定 = 默认),例如:

    "typescript": "3.5.3"