Skip to content
Development and deployment2 min read

What is npm (Node Package Manager)?

Short answer

npm (Node Package Manager) is the default package manager for Node.js and a public registry of JavaScript libraries. It installs the libraries your project lists in package.json, records their exact versions in package-lock.json, and runs commands such as build and test.

ArabyHost teamLast updated: ShareWhatsAppXLinkedIn
Contents
  1. The key files
  2. Essential commands
  3. Common problems
  4. On ArabyHost

npm comes bundled with Node.js, and the name covers three things: the command-line tool, the public registry at npmjs.com with millions of packages, and the company that runs it, which is part of GitHub.

The key files

  • package.json: project name, required packages and scripts.
  • package-lock.json: the exact version of every package and sub-dependency.
  • node_modules/: where packages are actually installed.
{
  "scripts": {
    "start": "node server.js",
    "build": "vite build"
  },
  "dependencies": { "express": "^4.21.0" },
  "devDependencies": { "vite": "^6.0.0" }
}

The ^ allows updates within the same major version (4.x) but never jumps to 5. devDependencies are build and development tools the app doesn’t need at runtime.

Essential commands

Command What it does
npm install Installs packages and updates the lockfile if needed
npm install axios Adds a new package to the project
npm ci Clean install that matches the lockfile exactly: right for servers and CI/CD
npm ci --omit=dev Skips dev dependencies in production
npm run build Runs the build script from package.json
npm audit Checks packages for known vulnerabilities

Common problems

  • EACCES on npm install -g: global installs need write access to system folders. Install the package locally or use npx: see npm EACCES.
  • ERESOLVE: conflicting peer dependencies; fixes on the ERESOLVE page.
  • Copying node_modules from Windows to a Linux server: some packages contain platform-specific binaries, so reinstall on the server.
  • Deleting the lockfile to “fix” things: it may work for now, but you’ll get new, untested versions.

On ArabyHost

On AI/Developer plans, Setup Node.js App creates a separate environment for each app, with a Run NPM Install button that installs from package.json. The CloudLinux selector keeps node_modules inside that environment and links it into your app folder with a symlink, so delete any uploaded node_modules folder before installing. Over SSH, activate the environment with the command shown on the app’s page, then run npm ci or npm run build. There’s no root access, so skip -g. Full steps in the Node.js deployment guide.

FAQ

What's the difference between npm and npx?

npm installs packages and manages the project; npx runs a command from a package without installing it globally, such as npx create-next-app. Both come with Node.js.

Should I delete package-lock.json?

No. It makes sure the server installs exactly the versions you tested. Commit it to Git and use npm ci on the server.

Why is node_modules so big?

It holds every package plus all of their dependencies. Don't commit it or upload it over FTP; recreate it on the server with an install command.

Useful? Share it with someone who needs it:WhatsAppXLinkedIn

Read next

Ready to put your idea online?

Fast, isolated hosting, support that understands you, and an AI assistant that fixes problems with you.