Is there a way to undo the command
You can restore your
package.json file to its previous state (hopefully you still have that, or at least remember what you had changed), and then do another
However, in general, this technique does not guarantee that your entire dependency tree will be restored to its exact former state (since the
package.json files in a dependency tree often loosely specify dependency versions).
If you need to ensure that your package's dependency tree can be restored exactly, you have to use something like npm shrinkwrap to "lock down" the dependency versions (before you publish the package).