转载

Automatically remove dependencies from package.json when using npm uninstall


问题:

After npm init I can add dependencies in my package.json using this: npm init我可以使用以下命令在package.json中添加依赖项:

npm install package --save

And say, I want to uninstall the package and I do so by doing: 并说,我想uninstall包,我这样做:

npm uninstall package

but I want my package.json to be updated accordingly too without me having to manually go to the file and delete that line. 但我希望我的package.json也能相应更新,而不必手动转到该文件并删除该行。

From the npm docs it says: 从npm文档中可以看出:

It is strictly additive, so it does not delete options from your package.json without a really good reason to do so. 它是严格加法的,因此它不会从package.json中删除选项而没有充分的理由这样做。

So, I just wanted to know if this is even possible. 所以,我只是想知道这是否可能。

解决方案:

参考: https://stackoom.com/en/question/1JSrb
{{o.name}}
{{m.name}}
  • 转载自:https://my.oschina.net/stackoom/blog/5393811
  • 留言