DEV Community

Lucien Boix
Lucien Boix

Posted on • Edited on

How to fix a npm install issue ?

Sometimes it can be good to start from scratch, especially if you are opening an old / legacy project. Here are the steps to follow in order to have a working dependency graph again :

  • delete the existing package-lock.json file
  • ran the following commands:

node -v (make sure you are using the same Node version than the pipeline that will build and deploy your project, if not see below)
npm cache clean -f
npm install

All should be good now.

If you need to quickly switch to another version of Node than the one currently setup on your workstation, you can use this powerful package n :
npm install -g n
sudo n stable
sudo n (choose + Enter)
node -v


Note : same remark if you need to run a npm audit fix, then make sure you are using the same Node version than the pipeline that will build and deploy your project

Top comments (0)