尝试将 Angular 更新到 13 破坏了一堆东西,现在尝试返回 Angular 11 怎么办?
首先,我是唯一一个参与这个项目的人,所以我们可以完全摧毁除了代码之外的所有东西。
我已经尝试过类似的操作,但没有效果,
npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@11
当我尝试运行 ngserve
时,
bullshit@ChristohersMBP2 decksite % ng serve
This version of CLI is only compatible with Angular versions ^13.0.0,
but Angular version 12.2.16 was found instead.
Please visit the link below to find instructions on how to update Angular.
https://update.angular.io/
当前情况是这样的,我所做的稍微有用的就是恢复到项目中的旧提交,但现在这不再是一个选择。
所以我的想法是清除我的 package.json
并删除 package-lock.json
并删除 node_modules
并尝试再次安装 Angular 11 cli (以及我需要的所有其他 npm 库,因为我不再填充 package.json。
或者更好的是从较旧的提交中获取 package.json
因为这仍然是一个选项,然后执行无论我必须在本地做什么才能完全擦除所有内容删除当前的 package.json
、 package-lock.json
、node_modules
并运行 npm uninstall 上的所有内容?我不知道我必须做什么才能擦除。
将新的 package.json
放入我的 Angular 项目中,然后点击
看起来像的 npm install
命令。非常好的解决方案,我打对地方了吗?
First I am the only one working on this project so we can completely nuke everything but the code of course.
I have tried things like this with no effect
npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@11
when I try to run ng serve
the current situation is like this
bullshit@ChristohersMBP2 decksite % ng serve
This version of CLI is only compatible with Angular versions ^13.0.0,
but Angular version 12.2.16 was found instead.
Please visit the link below to find instructions on how to update Angular.
https://update.angular.io/
What I did do that worked for a little is revert back to a old commit in my project but now that is not an option any more.
so my thoughts are to clear my package.json
and delete package-lock.json
and delete node_modules
and try to install the angular 11 cli again (as well as all other npm libraries i need since I no longer have my package.json populated.
Or even better go grab the package.json
from a older commit since that is still an option and then do whatever I have to do on my local to completely wipe everything that is not source code. Delete current package.json
, package-lock.json
, node_modules
, and run npm uninstall
on everything? IDK whatever I have to do to wipe.
Place the new package.json
in my angular project and then hit the npm install
command.
that seems like a really good solution, am I hitting in the right place?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通常通过 (
ng update
) 执行以下操作:npm install @angular/x, y, z
。--force
有时可以完成该部分。我相信从 11 点到 13 点,您将会看到 Webpack 5 更新和其他重大更改。因此,根据您拥有的第 3 方 ie commonjs 样式包的数量,您可能需要使用架构师->构建->选项来调整您的 angular.json 文件:
I typically do the following via (
ng update
):npm install @angular/x, y, z
per the list.--force
can some times get that part done.I believe from 11 to 13 you are going by Webpack 5 updates and other breaking changes. So depending on how much 3rd party i.e. commonjs style packages you have you may need to tweak your angular.json file with architect->build->options: