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
Connecting with Your Audience: 15 Tips for a Productive Q&A Session
Highest Paying Travel Nurse Agency in U.S. (2023) - ESHYFT
Pollen Count Centreville Va
CLI Book 3: Cisco Secure Firewall ASA VPN CLI Configuration Guide, 9.22 - General VPN Parameters [Cisco Secure Firewall ASA]
Sandrail Options and Accessories
Aadya Bazaar
Costco The Dalles Or
Craigslist Nj North Cars By Owner
Www Movieswood Com
Nieuwe en jong gebruikte campers
Our History | Lilly Grove Missionary Baptist Church - Houston, TX
Degreeworks Sbu
REVIEW - Empire of Sin
Methodist Laborworkx
Summoners War Update Notes
Seattle Rpz
Craigslist Farm And Garden Cincinnati Ohio
ᐅ Bosch Aero Twin A 863 S Scheibenwischer
Quest Beyondtrustcloud.com
Download Center | Habasit
Xxn Abbreviation List 2023
Swedestats
Zack Fairhurst Snapchat
Foxy Brown 2025
Robin D Bullock Family Photos
Aps Day Spa Evesham
Parc Soleil Drowning
Two Babies One Fox Full Comic Pdf
Directions To Cvs Pharmacy
Naval Academy Baseball Roster
Nesb Routing Number
Mynahealthcare Login
Possum Exam Fallout 76
The Bold and the Beautiful
R/Sandiego
Rock Salt Font Free by Sideshow » Font Squirrel
Sun Haven Pufferfish
2024 Ford Bronco Sport for sale - McDonough, GA - craigslist
Craigslist List Albuquerque: Your Ultimate Guide to Buying, Selling, and Finding Everything - First Republic Craigslist
Elisabeth Shue breaks silence about her top-secret 'Cobra Kai' appearance
2008 DODGE RAM diesel for sale - Gladstone, OR - craigslist
Craigslist Com Panama City Fl
US-amerikanisches Fernsehen 2023 in Deutschland schauen
FREE - Divitarot.com - Tarot Denis Lapierre - Free divinatory tarot - Your divinatory tarot - Your future according to the cards! - Official website of Denis Lapierre - LIVE TAROT - Online Free Tarot cards reading - TAROT - Your free online latin tarot re
Wordle Feb 27 Mashable
Senior Houses For Sale Near Me
Fredatmcd.read.inkling.com
300 Fort Monroe Industrial Parkway Monroeville Oh
Festival Gas Rewards Log In
Uncle Pete's Wheeling Wv Menu
OSF OnCall Urgent Care treats minor illnesses and injuries
Elizabethtown Mesothelioma Legal Question
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.