Automatically remove dependencies from package.json when using npm uninstall

前端 未结 2 592
野趣味
野趣味 2021-01-30 19:47

After npm init I can add dependencies in my package.json using this:

npm install package --save

And say, I want to uninstall

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-30 20:09

    In my case --save did not clear the entry from package.json, the command as suggested by ionic-check I think if the uninstall happens to exit with any errors package.json will not be updated in which case you only have an option to manually change package.json, this is tedious but the only way I guess

    UPDATE

    when you uninstall a package which has a dependency on other package which is active then which case uninstall may fail with errors/warnings, the safe method is through following dependency graph not sure if there any tool available, a handy tool under such operations, warning messages are quite misleading though "you must install peer dependencies.." doesn't make any sense when we are uninstalling a package

提交回复
热议问题