加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

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

发布时间:2020-12-17 07:31:55 所属栏目:安全 来源:网络整理
导读:我的项目运行在dot net core 2.0上,角度为4.2. 我将它更新为最新的角度(5.0.0). 从那时起,在startup.cs Configure方法中抛出异常. app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions { HotModuleReplacement = true }); 这里因错误而失败 Error:
我的项目运行在dot net core 2.0上,角度为4.2.
我将它更新为最新的角度(5.0.0).
从那时起,在startup.cs Configure方法中抛出异常.
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
 {
     HotModuleReplacement = true
 });

这里因错误而失败

Error: Version of @angular/compiler-cli needs to be 2.3.1 or greater. 
Current version is "5.0.0".
at Object.<anonymous> (D:PersonalCodePettlyUiPettlyUinode_modules@ngtoolswebpacksrcindex.js:27:11)
at Module._compile (module.js:641:30)
at Object.Module._extensions..js (module.js:652:10)

当我从命令行使用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
既然没有答案,我会写出解决问题的方法

可能会出现此问题,因为Angular已更新到版本5.0.0但ngtools仍然更旧.这会导致webpack命令失败.使用此命令将webpack更新为最新版本,

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

错误错误地尝试指向旧的compiler-cli版本,显然不是这种情况.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读