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
Most Popular | FAQ | E*TRADE
Celebrating New Year's Eve 2024 in Style: Fashionably Ushering in the | Hey Honey
Encore Atlanta Cheer Competition
1970 Chevelle Ss For Sale Craigslist
T Mobile Rival Crossword Clue
Chase Bank Operating Hours
Richard Sambade Obituary
Kent And Pelczar Obituaries
You can put a price tag on the value of a personal finance education: $100,000
Dusk
Koop hier ‘verloren pakketten’, een nieuwe Italiaanse zaak en dit wil je ook even weten - indebuurt Utrecht
Webcentral Cuny
Espn Horse Racing Results
Quick Answer: When Is The Zellwood Corn Festival - BikeHike
Cincinnati Adult Search
Greyson Alexander Thorn
683 Job Calls
Mandy Rose - WWE News, Rumors, & Updates
3569 Vineyard Ave NE, Grand Rapids, MI 49525 - MLS 24048144 - Coldwell Banker
2023 Ford Bronco Raptor for sale - Dallas, TX - craigslist
Pokémon Unbound Starters
Insidious 5 Showtimes Near Cinemark Southland Center And Xd
Nikki Catsouras: The Tragic Story Behind The Face And Body Images
Poe T4 Aisling
+18886727547
Chicago Pd Rotten Tomatoes
Rock Salt Font Free by Sideshow » Font Squirrel
Clearvue Eye Care Nyc
6143 N Fresno St
Old Peterbilt For Sale Craigslist
Goodwill Thrift Store & Donation Center Marietta Photos
Hannibal Mo Craigslist Pets
Oxford Alabama Craigslist
Best Restaurant In Glendale Az
Linda Sublette Actress
Final Jeopardy July 25 2023
Gifford Christmas Craft Show 2022
Lovein Funeral Obits
How to Print Tables in R with Examples Using table()
2007 Jaguar XK Low Miles for sale - Palm Desert, CA - craigslist
Leland Nc Craigslist
Conan Exiles Tiger Cub Best Food
Hillsborough County Florida Recorder Of Deeds
Server Jobs Near
Used Sawmill For Sale - Craigslist Near Tennessee
Shiftselect Carolinas
Jimmy John's Near Me Open
Powah: Automating the Energizing Orb - EnigmaticaModpacks/Enigmatica6 GitHub Wiki
Glowforge Forum
What Responsibilities Are Listed In Duties 2 3 And 4
7 National Titles Forum
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.