Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is `"dev" true` in package-lock.json for?

What does "dev" true means in package-lock.json file?

In my case it is automatically updated when I perform npm operations.

How can we remove it?

like image 649
Mustafa bw Avatar asked Apr 13 '18 04:04

Mustafa bw


People also ask

What is npm save Dev?

npm install [package-name] –save-dev: When –save-dev is used with npm install, it signifies that the package is a development dependency. A development dependency is any package that absence will not affect the work of the application.

What is requires in package lock json?

"requires" reflects dependencies from package. json file of this dependency, while dependencies reflects actually installed dependencies in node_modules folder of this dependency.

What is Package lock json Should I commit?

The package-lock. json file needs to be committed to your Git repository, so it can be fetched by other people, if the project is public or you have collaborators, or if you use Git as a source for deployments. The dependencies versions will be updated in the package-lock. json file when you run npm update .

Does package lock json update automatically?

package-lock. json is updated automatically on dependency changes. It should be committed to version control to ensure the same dependencies on install.


2 Answers

So answering your first question, "dev": true in package-lock.json means this dependency won't be installed by npm install/npm ci when running in production mode.

Having dependencies used only for local development environment marked with "dev": true and then using --production in your CI might save you some build time.

From documentation https://docs.npmjs.com/cli/install#description:

By default, npm install will install all modules listed as dependencies in package.json.

With the --production flag (or when the NODE_ENV environment variable is set to production), npm will not install modules listed in devDependencies.

like image 69
gordey4doronin Avatar answered Sep 26 '22 20:09

gordey4doronin


From the npm docs at https://docs.npmjs.com/files/package-lock.json

If true then this dependency is either a development dependency ONLY of the top level module or a transitive dependency of one. This is false for dependencies that are both a development dependency of the top level and a transitive dependency of a non-development dependency of the top level.

like image 35
Elliott Sipple Avatar answered Sep 25 '22 20:09

Elliott Sipple