Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm install removes "dev": true from several packages in package-lock.json?

Today I pulled latest from a shared Git repository and noticed that another developer on my team added an NPM package. So I ran npm install, and then saw that my package-lock.json file had changed. When I dug into what had changed, I found that "dev": true had been removed from several package descriptions, for example:

"some-package": {
  "version": "1.0.0",
  "resolved": "https://registry.npmjs.org/whatever/-/some-package-1.0.0.tgz",
  "integrity": "some-big-hash",
  "dev": true
},

The "dev": true is gone after npm install from several packages. Should I be concerned that NPM did this? I don't want these packages to be installed for production.

This question about "dev": true is somewhat related, but there isn't a good answer yet and I still want to know if I'm doing something wrong. Why is NPM removing this?

like image 953
AJ. Avatar asked Sep 10 '25 23:09

AJ.


2 Answers

Your "dev": true disappeared because the package became a non-dev dependency.

A package with "dev": true is only needed in development, not in production.

This means it is required, directly or indirectly, only via devDependencies and not via anything in dependencies.

It will not be installed if you do npm install --production or have NODE_ENV=production in the environment.

like image 193
Denis Howe Avatar answered Sep 12 '25 15:09

Denis Howe


You need to remove legacy-peer-deps=true from git config

like image 31
iKBAHT Avatar answered Sep 12 '25 16:09

iKBAHT