# npm ERR! The `npm ci` command can only install with an existing package-lock.json or npm-shrinkwrap.json

**Code:** `npm ci no lockfile` · **Category:** npm · **Seen on:** npm

npm ci needs a committed lockfile and didn’t find one.

## Meaning

Lockfile not committed (gitignored), or the project uses yarn/pnpm lockfiles instead.

## Common causes

- package-lock.json in .gitignore
- Project uses yarn.lock or pnpm-lock.yaml

## Quick fix

1. Generate and commit package-lock.json
2. Use the project’s package manager in CI (yarn install --frozen-lockfile, pnpm install --frozen-lockfile)

## Detailed fix by platform

### npm

1. `npm install --package-lock-only && git add package-lock.json`

## How to diagnose

1. **Files** — Which lockfile exists?
2. **Recent change** — Did it start after a deploy, upgrade, or configuration change? Compare with the last working version.

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/npm/npm-ci-requires-lockfile)
