相关疑难解决方法(0)

将Angular 4.x迁移到Angular 5

我已阅读以下博客和文档

并没有关于如何从4.x迁移到5的明确信息.

尝试以下命令

  • npm安装

    npm install @angular/{animations,common,compiler,compiler-cli,
                core,forms,http,platform-browser,platform-browser-dynamic,
                platform-server,router}@5.0.0
    
    Run Code Online (Sandbox Code Playgroud)
  • 纱线安装

    yarn add @angular/{animations,common,compiler,compiler-cli,
             core,forms,http,platform-browser,platform-browser-dynamic,
             platform-server,router}@5.0.0
    
    Run Code Online (Sandbox Code Playgroud)
  • 尝试了更新指南

     npm install @angular/animations@'^5.0.0' @angular/common@'^5.0.0' 
            @angular/compiler@'^5.0.0' @angular/compiler-cli@'^5.0.0' 
            @angular/core@'^5.0.0' @angular/forms@'^5.0.0'
            @angular/http@'^5.0.0' @angular/platform-browser@'^5.0.0' 
            @angular/platform-browser-dynamic@'^5.0.0' 
            @angular/platform-server@'^5.0.0' @angular/router@'^5.0.0' 
            typescript@2.4.2 rxjs@'^5.5.2'
    
     npm install typescript@2.4.2 --save-exact
    
    Run Code Online (Sandbox Code Playgroud)

没有什么比我好.请帮忙

angular angular5

32
推荐指数
2
解决办法
3万
查看次数

升级到angular 5后,webpack命令失败

我的项目运行在dot net core 2.0上,角度为4.2.我将它更新为最新的角度(5.0.0).从那时起,在startup.cs Configure方法中抛出异常.

 app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
 {
     HotModuleReplacement = true
 });
Run Code Online (Sandbox Code Playgroud)

这里因错误而失败

Error: Version of @angular/compiler-cli needs to be 2.3.1 or greater. 
Current version is "5.0.0".
at Object.<anonymous> (D:\Personal\Code\PettlyUi\PettlyUi\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)
Run Code Online (Sandbox Code Playgroud)

当我从命令行使用webpack时也会抛出相同的错误.

我也尝试过同样的新项目,但一直都失败了.这是某种错误还是我没有正确更新.

用于升级的命令:

npm install @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 @angular/animations@latest typescript@latest
Run Code Online (Sandbox Code Playgroud)

visual-studio webpack asp.net-core angular angular5

8
推荐指数
1
解决办法
2200
查看次数

Angular:升级到版本5错误:@ angular/compiler-cli的版本需要为2.3.1或更高版本.当前版本是"5.0.0"

放弃

可能重复,但详细问题并未显示相关的具体错误消息,因此它含糊不清且无益.当我在Google中输入错误时,我根本无法找到它,这是因为他的问题在任何地方都没有包含错误.

除非为了清楚起见编辑了其他问题,否则请不要关闭此问题,因为相关错误没有其他结果.


尝试ng serve在升级到v5后运行,但遇到一些错误.谁知道怎么了?@angular/compiler-cli根据package.json 我是5.0.0 ...不确定为什么它说5.0.0小于2.3.1.

这是我的升级命令:

npm install @angular/{animations,common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-server,router}@5.0.0
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

$ ng serve
Your global Angular CLI version (1.5.0) is greater than your local
version (1.0.0). The local Angular CLI version is used.

To disable this warning use "ng set --global warnings.versionMismatch=false".
Version of @angular/compiler-cli needs to be 2.3.1 or greater. Current version is "5.0.0".
Error: Version of @angular/compiler-cli needs to be 2.3.1 or greater. Current version is "5.0.0".
    at Object.<anonymous> …
Run Code Online (Sandbox Code Playgroud)

npm angular

7
推荐指数
1
解决办法
1万
查看次数

标签 统计

angular ×3

angular5 ×2

asp.net-core ×1

npm ×1

visual-studio ×1

webpack ×1