Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does 'npm install' remove my installed packages in angular cli?

Tags:

node.js

npm

The npm install [package] command is removing other packages previously installed.

If I run npm install [package b], it will install package b but remove package a. This occurs vice versa with other packages.

This happens when install the ng-bootstrap dependency using the following command npm install --save @ng-bootstrap/ng-bootstrap and later install the following dependency npm install ng2-ion-range-slider --save, in this case ng-bootstrap dependency is removed of my node_modules. My questions is why this happens? What is the explanation of this strange behavior?

like image 569
AlejoDev Avatar asked Oct 27 '25 09:10

AlejoDev


1 Answers

In my case it happened due to outdated package-lock.json (it was not commited to git after latest package.json change).

Solution: do plain npm i to fix your package-lock.json

After this npm i [packages] should work as expected

like image 98
Pavel Gurecki Avatar answered Oct 29 '25 22:10

Pavel Gurecki