package.json vs. package-lock.json (2024)

Working in DevSecOps, I often encounter developers that are certain they have patched a vulnerability, but since they do not fully understand the `package*.json` files the vulnerability is still being flagged.

Although `package.json` is automatically generated and updated by npm, it can also be edited manually. This allows you to change the metadata and npm module dependencies for your NodeJS project with ease.

In general, `package.json` doesn’t specify exact version numbers for dependencies (although it can if you want it to). Instead, `package.json` generally sets the minimum version for each dependency, and it can also set a range of versions. In addition, `package.json` only tracks top-level dependencies for the project. You don’t need to specify dependencies of dependencies; that’s handled automatically for you. This makes `package.json` smaller in size, more accurate, and much more human-readable.

The problem with `package.json` is that you and your vulnerability scanner can end up seeing different versions of dependencies. Yet worse, you could be running different versions compared to what is running in production. That’s because `package.json` usually doesn’t specify exact versions, so depending on when/where you invoke npm install, you can see different versions than a vulnerability scanner. This is a recipe for disaster and lots of unneeded work.

The `package-lock.json` file was introduced in npm version 5 to solve this problem. It is a generated file and is not designed to be manually edited. Its purpose is to track the entire tree of dependencies (including dependencies of dependencies) and the exact version of each dependency.

You should commit package-lock.json to your code repository. Sharing this file with teammates and the production environment is the best way to make sure that everyone has the same configuration for their copy of the project.

package.json vs. package-lock.json (2024)
Top Articles
How to get credit during a consumer proposal or bankruptcy
Coinbase vs Nexo: Top Crypto Platform Market in 2024 | Bitcompare
Avonlea Havanese
Tv Guide Bay Area No Cable
Es.cvs.com/Otchs/Devoted
A Complete Guide To Major Scales
83600 Block Of 11Th Street East Palmdale Ca
Santa Clara Valley Medical Center Medical Records
Myql Loan Login
Richmond Va Craigslist Com
2021 Lexus IS for sale - Richardson, TX - craigslist
Herbalism Guide Tbc
Ukraine-Russia war: Latest updates
Dusk
Caliber Collision Burnsville
Help with Choosing Parts
735 Reeds Avenue 737 & 739 Reeds Ave., Red Bluff, CA 96080 - MLS# 20240686 | CENTURY 21
National Office Liquidators Llc
Wisconsin Women's Volleyball Team Leaked Pictures
Craigslist Free Stuff Greensboro Nc
Cambridge Assessor Database
NHS England » Winter and H2 priorities
Kiddle Encyclopedia
Phoebus uses last-second touchdown to stun Salem for Class 4 football title
The Tower and Major Arcana Tarot Combinations: What They Mean - Eclectic Witchcraft
Aol News Weather Entertainment Local Lifestyle
Who is Jenny Popach? Everything to Know About The Girl Who Allegedly Broke Into the Hype House With Her Mom
Bennington County Criminal Court Calendar
Teekay Vop
Drift Hunters - Play Unblocked Game Online
How To Tighten Lug Nuts Properly (Torque Specs) | TireGrades
Beaufort 72 Hour
Catchvideo Chrome Extension
Miles City Montana Craigslist
Cowboy Pozisyon
Jailfunds Send Message
John Deere 44 Snowblower Parts Manual
Craigslist/Phx
Pfcu Chestnut Street
Barrage Enhancement Lost Ark
Arcadia Lesson Plan | Day 4: Crossword Puzzle | GradeSaver
Ise-Vm-K9 Eol
888-333-4026
Seminary.churchofjesuschrist.org
Tableaux, mobilier et objets d'art
Pain Out Maxx Kratom
tampa bay farm & garden - by owner "horses" - craigslist
Electric Toothbrush Feature Crossword
Raley Scrubs - Midtown
Turning Obsidian into My Perfect Writing App – The Sweet Setup
Craigslist Farm And Garden Missoula
Latest Posts
Article information

Author: Nathanael Baumbach

Last Updated:

Views: 5872

Rating: 4.4 / 5 (55 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Nathanael Baumbach

Birthday: 1998-12-02

Address: Apt. 829 751 Glover View, West Orlando, IN 22436

Phone: +901025288581

Job: Internal IT Coordinator

Hobby: Gunsmithing, Motor sports, Flying, Skiing, Hooping, Lego building, Ice skating

Introduction: My name is Nathanael Baumbach, I am a fantastic, nice, victorious, brave, healthy, cute, glorious person who loves writing and wants to share my knowledge and understanding with you.