AlejoDev
AlejoDev

Reputation: 3202

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

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?

Upvotes: 4

Views: 6548

Answers (1)

Pavel Gurecki
Pavel Gurecki

Reputation: 1209

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

Upvotes: 2

Related Questions