admin管理员组

文章数量:1402850

While in the process of updating an Angular app I and colleagues are working on, I ended up running "npm update" when I meant to run "npm install". Doing so led me on a bit of a rabbit trail because of course now all my dependencies - AND their dependencies got updated in the process. From there I had to resolve certain conflicts to get the new versions to work correctly. However, this also led me to a point where a bug in one of those dependencies is preventing my app from booting up. According to the the Angular github repo, the issue is being worked on.

My question is, how can I revert to my previous setup in the meantime? I tried copy and pasting the package.json file as it originally existed before my "npm update", deleting my "node modules" folder, and running "npm install" again. But this doesn't resolve the issue. Is there a way I can be assured of reverting to my previous working setup?

While in the process of updating an Angular app I and colleagues are working on, I ended up running "npm update" when I meant to run "npm install". Doing so led me on a bit of a rabbit trail because of course now all my dependencies - AND their dependencies got updated in the process. From there I had to resolve certain conflicts to get the new versions to work correctly. However, this also led me to a point where a bug in one of those dependencies is preventing my app from booting up. According to the the Angular github repo, the issue is being worked on.

My question is, how can I revert to my previous setup in the meantime? I tried copy and pasting the package.json file as it originally existed before my "npm update", deleting my "node modules" folder, and running "npm install" again. But this doesn't resolve the issue. Is there a way I can be assured of reverting to my previous working setup?

Share Improve this question asked May 2, 2017 at 16:06 ReyRey 1,4332 gold badges17 silver badges32 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

The process you described should work:

  • Get an old copy of your package.json from your repository at the state you know it worked
  • Run rm -rf node_modules to remove the node_modules folder
  • Run npm install to install again

If that didn't work, verify that you:

  • are in the correct directory (that should contain package.json and node_modules)
  • have permissions to clean the node_modules folder (chmod 777 node_modules)
  • the package.json that is written in the file system is actually the restored one (sometimes an IDE or Git can create a weird shadow copy where you think it's one way, but it's really another). You can tell this by using cat package.json and inspecting the output

本文标签: javascriptReverting to Previous Version of Packagejson When a Dependency Bug ArisesStack Overflow