Skip to main content
Servers Are Up
Virtual Datacenter
PricingFree Tools
Sign inBrowse catalog
Servers Are Up
Virtual Datacenter
PricingFree Tools
Sign inBrowse catalog

Loading…

Servers Are Up

Your apps, automation and data on hardware we own. Build a private stack with predictable capacity and access through your dashboard, API or SSH.

SLA with service creditsOwned hardwareUS-based

Make room for your next idea

Explore the capacity, apps and access options that fit your workload. Check current availability and your total before you buy.

Sign up freeView Pricing

Products

  • Linux VPS
  • Windows VPS
  • Cloud & SaaS Services
  • Cloud Storage (Azure)
  • Virtual Datacenter
  • AI & Agent Hosting
  • Containers
  • Instant Apps
  • Software Platforms
  • Network builder
  • Game Servers
  • Free Game Servers
  • Pricing

Resources

  • Free Network Tools
  • 2026 Pricing Benchmark
  • Live SVG Badges
  • Latency & Speed Test
  • Guides & Tutorials
  • Documentation
  • API Reference
  • MCP Server
  • CLI & SDKs
  • OpenAPI & llms.txt
  • Use Cases
  • Free Migration
  • Uptime & Reliability
  • Datacenter
  • System Status
  • Network
  • Provider Comparisons Hub
  • Compare Providers

Company

  • About Us
  • Enterprise
  • Security Architecture
  • Trust Center
  • Blog
  • FAQ
  • Compliance
  • Startup Program
  • Open-Source Sponsorship
  • Press & Media Kit
  • Referral Program
  • Help Center
  • Contact Us
© Servers Are Up
TermsPrivacySLARefund PolicyDPAAcceptable Use
Service information
Docs
  • Documentation Hub
  • Technical Knowledge Library
    Runbooks & 187 Blueprints
  • Choose a Product
    VMs, Containers & Cloud
  • First Linux Server
    SSH, Firewall & Apps
  • Windows Server 2025
    BYOL & Remote Desktop
  • Remote Access
  • Troubleshooting
  • FAQ
  • All Product Guides
    29 Step-by-Step Guides
  • Cloud & SaaS Catalog
    112 Cloud & SaaS Offerings
  • Azure Cloud Storage
    Hot/Cool/Archive & WORM
  • Resource Manager & RBAC
    Groups, Tags & Locks
  • Multi-Model Cloud DB
    JSONB, SQL & pgvector
  • Cloud Identity & ZTNA
    OIDC, SCIM & PIM
  • Key Vault & KMS
    Secrets & Envelope Keys
  • Cloud SIEM, SOAR & DLP
    Posture & Threat Response
  • API Gateway & Cloud DNS
    Edge WAF & DNS Zones
  • Serverless, Workflows & IoT
    Functions, Queues & DAGs
  • SaaS, Governance & Vault
    Budgets & Off-Host GRS
  • Linux Systems & Kernel
    SSH, UFW, sysctl & OOM
  • Self-Hosted Apps & Stacks
    Caddy, Nextcloud & Auth
  • Build Web Apps with AI
  • Next.js and React
  • TypeScript and Node.js
  • npm and Tooling
  • Data and APIs
  • Deploy and Operate
  • Tutorials
  • Infrastructure
  • Automation & Regions
  • API Overview
  • API v1 Reference
    Endpoints & 23 Scopes
  • MCP Server
    129 AI Agent Tools
  • Swagger / OpenAPI 3.1
  • API Playground
  • Versioning & Sunset
  • API Token Security
    Authentication & Tokens
  • Instances API
    Compute Resources
  • Networking API
    Networks & Ports
  • Storage API Availability
    Volumes & Backups
  • Webhooks & Events
    Event Notifications
  • Rate Limits & Best Practices
    Throttling & Retries
  • sau CLI Reference
    34 Commands (v0.2)
  • Browser Web CLI
  • SDKs
  • Infrastructure as Code
    Terraform & Ansible
  • Code Examples
  • CLI & SDK Guides
  • Security Guides
  • Security at a Glance
  • Zero Trust Architecture
  • Live Trust Center
  • Compliance
Need help?

Loading documentation...

Documentation/npm tooling

Use the lockfile so every machine installs the same tree

Understand what package-lock.json records, install from it with npm ci on build servers, and repair it when it disagrees with package.json.

Beginner
15 min
Updated 2026-10-13

Deploy Ready-to-Run Infrastructure in Seconds

Linux VMs from $6/mo · Pooled Virtual Datacenters from $12/mo · Use code WELCOME20 for 20% off your first order.

Browse ServersView Pricing

Commands checked on 2026-10-13 with npm 11, Node.js 24.

What you will have at the end

You will know which of your two dependency files decides what gets installed, which install command to use on your own machine and which on a build server, and what to do when the two files disagree. Your builds will install the same packages every time, on every machine.

Before you start

  • A project with a package.json and a package-lock.json. The app from Start a Next.js app with TypeScript, linting and a first test is the one used here.
  • Node.js 24 and npm 11.

Steps

1. See what each file says

package.json holds ranges: what you are willing to accept.

"dependencies": {
  "next": "16.4.0",
  "react": "19.3.0",
  "react-dom": "19.3.0"
}

package-lock.json holds the result: every package that was installed, the packages they brought with them, and for each one where it came from and a checksum of its content.

node -p 'require("./package-lock.json").lockfileVersion'
node -p 'Object.keys(require("./package-lock.json").packages).length'

On our project the answers are 3 and 507. Three packages were asked for; 507 were installed. One entry looks like this:

{
  "version": "19.3.0",
  "resolved": "https://registry.npmjs.org/react/-/react-19.3.0.tgz",
  "integrity": "sha512-E8LUcbtBWt20bbl2YoHfx4Z..."
}

The integrity line is why a lockfile is also a safety measure: a package whose content changed after you locked it does not install.

2. Install from the lockfile, exactly

npm ci

npm ci deletes node_modules, installs exactly what the lockfile lists, and never changes either file. On our project it took 10 seconds. Use it on build servers, in containers, and whenever you want to be sure your folder matches the repository.

npm install is for changing dependencies: it may update the lockfile to match package.json.

3. See what happens when the two files disagree

Add a dependency to package.json without installing it:

npm pkg set dependencies.is-odd="^3.0.1"
npm ci

npm ci refuses, and changes nothing:

npm error code EUSAGE
npm error `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.
npm error Missing: is-odd@3.0.1 from lock file
npm error Missing: is-number@6.0.0 from lock file

This refusal is the feature. A build server that silently resolved the new dependency would be running code nobody reviewed.

4. Repair the lockfile

Bring the lockfile up to date without touching node_modules, then look at what changed before you commit it:

npm install --package-lock-only
git diff --stat package-lock.json

For this guide, undo the experiment instead:

git checkout package.json package-lock.json
npm ci

5. Install only what production needs

npm ci --omit=dev
du -sh node_modules

This leaves out everything under devDependencies: test tools, linters, type definitions. On our project it installed 22 packages where the full install has more than 400, and node_modules shrank from 535 MB to 342 MB. Use it for the final stage of a container image, after the build has run with the full install.

Check that it works

A project is reproducible when a clean copy installs and builds with nothing but the repository:

git status --porcelain package.json package-lock.json
npm ci
npm run build

The first command prints nothing: both files are committed. The other two succeed.

What can go wrong

  • npm ci passes although you added a dependency by hand. It happened to us with zod: the package was already in the lockfile because another package depends on it, so the lockfile satisfied the new line. npm ci checks that the two files agree, not that you ran npm install. Add dependencies with npm install NAME, never by editing the file.
  • The lockfile changes on every install. Two people are using different major versions of npm. Agree on one, and record it in package.json under engines.
  • A merge conflict in package-lock.json. Do not resolve it by hand. Resolve package.json, then run npm install --package-lock-only and let npm write the lockfile again.
  • npm ci is slow on the build server. It downloads every package each time unless the cache survives between runs. npm config get cache prints the folder to keep; on our machine it is ~/.npm.

Good practice

  • Commit package-lock.json for every application. Leaving it out means every install is a new experiment.
  • Use npm ci wherever a human is not choosing versions: build servers, containers, deployment scripts.
  • Read the lockfile's diff in a review as you read code. A changed resolved address or a package you did not ask for is worth a question.
  • Change one dependency per commit when you can. When something breaks, the commit that broke it names the package.

Where to go next

  • Read an npm audit report and decide what to do
  • Turn on strict TypeScript and fix the first errors

Related Articles

Read an npm audit report and decide what to do

Read more

Frequently Asked Questions

What does the Use the lockfile so every machine installs the same tree documentation guide cover?
Understand what package-lock.json records, install from it with npm ci on build servers, and repair it when it disagrees with package.json. It is rated beginner difficulty (15 min) and applies to Servers Are Up infrastructure and workflows.
Can I manage or automate these steps through the Servers Are Up dashboard, REST API v1, or MCP server?
Yes. Every Servers Are Up server includes browser-based SSH, WebRDP, and VNC console access in the dashboard, plus programmatic control via the REST API v1 (/api/v1) and hosted Model Context Protocol server (/api/mcp/v1) using a scoped Personal Access Token.

Need hands-on help with Use the lockfile so every machine installs the same tree?

Every Servers Are Up virtual machine and container includes an integrated HTML5 browser-based SSH, RDP, and VNC console in your dashboard, default-off inbound firewall rules with per-IP allow-lists, and full programmatic control via REST API v1 and Model Context Protocol (MCP). Explore our Virtual Datacenter Plans or reach out to Servers Are Up Support.

Was this article helpful?

On this page

What you will have at the endBefore you startSteps1. See what each file says2. Install from the lockfile, exactly3. See what happens when the two files disagree4. Repair the lockfile5. Install only what production needsCheck that it worksWhat can go wrongGood practiceWhere to go next
Need Live Commands?

Open Aria in Wide Engineering Mode for distro-specific commands, compose tweaks, and isolated environment troubleshooting.

Knowledge Library