且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

通过ng build构建角度项目时找不到angular.json文件错误

更新时间:2023-11-15 20:37:28

我假设您的项目使用的是旧版本的angular cli(使用 angular-cli.json 文件),并且在您的项目上计算机是较新的版本,而需要 angular.json .

I Supposed your project is use an old version of angular cli (this use the angular-cli.json file) and on your computer is a newer version that require the angular.json instead.

要对此进行归档,您应该运行 ng update @ angular/cli .Somethimes需要运行两次.然后,您应该有一个更新的项目.

In order to archieve this you should run ng update @angular/cli. Somethimes it require to run this twice. Then you should have an updated project.

用于更新的官方文档允许标记 migrate-仅.如果您只想归档迁移而不是完整的更新,这可能很有用.然后运行: ng update @ angular/cli --from = x.x.x-仅迁移其中 x.x.x 代表您的cli的实际版本.

The official documentation for updates allow the flag migrate-only. This can be usefull if you only want to archieve a migration and not a complete update. then run: ng update @angular/cli --from=x.x.x --migrate-only where x.x.x represents your actual version of cli.