NPM install hangs when Extracting Packages

by||1 min read
NPM Install
NPM Install

NPM can sometimes be a bit annoying. Recently I had the issue that npm install was stuck extracting certain packages. Here is one possible solution.

First, you could try to remove node_modules folder and re-run npm install. If this does not work, or ends up in the same situation, you can as well remove your package-lock.json file, remove the node_modules folder and re-run npm install.

Here are the steps:

  1. rm node_modules
  2. rm package-lock.json
  3. npm install

Another option is a mismatched NodeJS version. In some cases, a package-lock.json which was generated with a newer NodeJS version, can lead to lock ups during an npm install. I noticed this behavior when using different development machines (laptop at client site and a desktop at my home office). Different NodeJS versions can lead to unexpected behavior. This is why always advice to create a common development environment using Nix or Docker.

Thank you for reading this far! Let’s connect. You can @ me on Twitter (@debilofant) with comments, or feel free to follow. Please like/share this article so that it reaches others as well.

© Copyright 2022 - Ersocon - All rights reservedVer. 2.3.6.9