更新为角度5抛出@ angular/compiler-cli的版本必须为2.3.1或更高.当前版本是5.1.0 [英] Update to angular 5 throws Version of @angular/compiler-cli needs to be 2.3.1 or greater. Current version is 5.1.0

查看:136
本文介绍了更新为角度5抛出@ angular/compiler-cli的版本必须为2.3.1或更高.当前版本是5.1.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将角度4从asp.net core2升级到角度5(最新版本)

I want to upgrade angular 4 from asp.net core2 to angular 5 (latest one)

我执行了以下步骤:

  1. dotnet新角度

npm install @ angular/animations @ latest @ angular/common @ latest @ angular/compiler @ latest @ angular/compiler-cli @ latest @ angular/core @ latest @ angular/forms @ latest @ angular/http @ latest @ angular/platform-b​​rowser @ latest @ angular/platform-b​​rowser-dynamic @ latest @ angular/platform-server @ latest @ angular/router @ latest rxjs @ latest --save
npm install typescript@2.4.2 --save-exact

npm install @angular/animations@latest @angular/common@latest @angular/compiler@latest @angular/compiler-cli@latest @angular/core@latest @angular/forms@latest @angular/http@latest @angular/platform-browser@latest @angular/platform-browser-dynamic@latest @angular/platform-server@latest @angular/router@latest rxjs@latest --save
npm install typescript@2.4.2 --save-exact

  • npm install(确保)

  • npm install (to make sure)

    dotnet运行

    并产生错误:(@ angular/compiler-cli的版本必须为2.3.1或更高.当前版本为"5.1.0".) 而且我不知道如何解决它.

    and it produce error : (Version of @angular/compiler-cli needs to be 2.3.1 or greater. Current version is "5.1.0".) and i have no idea how to fix it.

    我的package.json

    my package.json

    {
      "name": "MyApp",
      "private": true,
      "version": "0.0.0",
      "scripts": {
        "test": "karma start ClientApp/test/karma.conf.js"
      },
      "devDependencies": {
        "@angular/animations": "^5.1.0",
        "@angular/cli": "^1.6.0",
        "@angular/common": "^5.1.0",
        "@angular/compiler": "^5.1.0",
        "@angular/compiler-cli": "^5.1.0",
        "@angular/core": "^5.1.0",
        "@angular/forms": "^5.1.0",
        "@angular/http": "^5.1.0",
        "@angular/platform-browser": "^5.1.0",
        "@angular/platform-browser-dynamic": "^5.1.0",
        "@angular/platform-server": "^5.1.0",
        "@angular/router": "^5.1.0",
        "@ngtools/webpack": "1.5.0",
        "@types/chai": "4.0.1",
        "@types/jasmine": "2.5.53",
        "@types/webpack-env": "1.13.0",
        "angular2-router-loader": "0.3.5",
        "angular2-template-loader": "0.6.2",
        "aspnet-prerendering": "^3.0.1",
        "aspnet-webpack": "^2.0.1",
        "awesome-typescript-loader": "3.2.1",
        "bootstrap": "3.3.7",
        "chai": "4.0.2",
        "css": "2.2.1",
        "css-loader": "0.28.4",
        "es6-shim": "0.35.3",
        "event-source-polyfill": "0.0.9",
        "expose-loader": "0.7.3",
        "extract-text-webpack-plugin": "2.1.2",
        "file-loader": "0.11.2",
        "html-loader": "0.4.5",
        "isomorphic-fetch": "2.2.1",
        "jasmine-core": "2.6.4",
        "jquery": "3.2.1",
        "json-loader": "0.5.4",
        "karma": "1.7.0",
        "karma-chai": "0.1.0",
        "karma-chrome-launcher": "2.2.0",
        "karma-cli": "1.0.1",
        "karma-jasmine": "1.1.0",
        "karma-webpack": "2.0.3",
        "preboot": "4.5.2",
        "raw-loader": "0.5.1",
        "reflect-metadata": "0.1.10",
        "rxjs": "^5.5.5",
        "style-loader": "0.18.2",
        "to-string-loader": "1.1.5",
        "typescript": "2.4.2",
        "url-loader": "0.5.9",
        "webpack": "2.5.1",
        "webpack-hot-middleware": "2.18.2",
        "webpack-merge": "4.1.0",
        "zone.js": "0.8.12"
      }
    }
    

    这是产生的异常错误:

    使用来自的启动设置 f:\ temp \ WebAppLinkSys \ MyApp \ MyApp \ Properties \ launchSettings.json ... 信息: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager [0] 用户个人资料可用.使用'C:\ Users \ adwin \ AppData \ Local \ ASP.NET \ DataProtection-Keys'作为密钥 存储库和Windows DPAPI来加密静态密钥.应用 启动异常:System.AggregateException:一个或多个错误 发生. (@ angular/compiler-cli的版本必须为2.3.1或 更大.当前版本是"5.1.0".错误:版本 @ angular/compiler-cli必须为2.3.1或更高.当前版本是 "5.1.0". 在对象. (f:\ temp \ WebAppLinkSys \ MyApp \ MyApp \ node_modules \ @ngtools \ webpack \ src \ index.js:27:11) 在Module._compile(module.js:641:30) 在Object.Module._extensions..js(module.js:652:10) 在Module.load(module.js:560:32) 在tryModuleLoad(module.js:503:12) 在Function.Module._load(module.js:495:3) 在Module.require(module.js:585:17) 在要求时(internal/module.js:11:18) 在对象. (f:\ temp \ WebAppLinkSys \ MyApp \ MyApp \ webpack.config.js:4:19) 在Module._compile(module.js:641:30))---> Microsoft.AspNetCore.NodeServices.HostingModels.NodeInvocationException: @ angular/compiler-cli的版本必须为2.3.1或更高.当前的 版本是"5.1.0".

    Using launch settings from f:\temp\WebAppLinkSys\MyApp\MyApp\Properties\launchSettings.json... info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0] User profile is available. Using 'C:\Users\adwin\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest. Application startup exception: System.AggregateException: One or more errors occurred. (Version of @angular/compiler-cli needs to be 2.3.1 or greater. Current version is "5.1.0". Error: Version of @angular/compiler-cli needs to be 2.3.1 or greater. Current version is "5.1.0". at Object. (f:\temp\WebAppLinkSys\MyApp\MyApp\node_modules\@ngtools\webpack\src\index.js:27:11) at Module._compile (module.js:641:30) at Object.Module._extensions..js (module.js:652:10) at Module.load (module.js:560:32) at tryModuleLoad (module.js:503:12) at Function.Module._load (module.js:495:3) at Module.require (module.js:585:17) at require (internal/module.js:11:18) at Object. (f:\temp\WebAppLinkSys\MyApp\MyApp\webpack.config.js:4:19) at Module._compile (module.js:641:30)) ---> Microsoft.AspNetCore.NodeServices.HostingModels.NodeInvocationException: Version of @angular/compiler-cli needs to be 2.3.1 or greater. Current version is "5.1.0".

    推荐答案

    找到了答案 升级到angular 5 webpack命令失败

    npm install --save-dev @ ngtools/webpack @ latest

    npm install --save-dev @ngtools/webpack@latest

    这篇关于更新为角度5抛出@ angular/compiler-cli的版本必须为2.3.1或更高.当前版本是5.1.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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