如何删除包使用角度 CLI?

角度6有新的 CLI 命令 ng add <package>

如何使用角度 CLI 删除包?

更新

文件

ng add将使用您的包管理器下载新的依赖项,并调用一个安装脚本(作为示意图实现) ,该脚本可以用配置更改更新您的项目,添加额外的依赖项(例如 polyfill) ,或者脚手架包特定的初始化代码

这不是同一个 npm install <package>

我试图使用 ng rm,但它还没有工作。

210013 次浏览

With the cli I don't know if it's a remove command but you can remove it from package.json and stop using it in your code. If you reinstall the packages you will not have it any more

You can use npm uninstall <package-name> will remove it from your package.json file and from node_modules.

If you do ng help command, you will see that there is no ng remove/delete supported command. So, basically you cannot revert the ng add behavior yet.

It's an open issue #900 on GitHub, unfortunately at this point of time it looks that in Angular CLI there's nothing like ng remove/rm/..., only using npm uninstall DEPENDENCY is the current workaround.

Sometimes a dependency added with ng add will add more than one package, typing npm uninstall lib1 lib2 could be error prone and slow, so just remove the not needed libraries from package.json and run npm i

I don't know about CLI, I had tried, but I couldn't. I deleted using IDE Idea history.

If You use an Intellij Idea, just open History changes.

Tap by main folder of the project -> right click -> local history -> show history.

Then from top to bottom revert changes.

enter image description here