The ELOCKVERIFY error occurs when package-lock.json and package.json are out of sync. This ensures reproducible builds by detecting when dependencies have changed.
npm ci (and npm install with certain flags) verifies that package-lock.json matches package.json. If they're out of sync - different versions, missing packages, or extra packages - npm refuses to proceed. This verification ensures reproducible builds. The lock file should exactly match what package.json specifies, and any changes should be intentional and committed together.
Create fresh lock file:
rm package-lock.json
npm installThis creates a new lock file matching package.json.
npm install updates the lock file:
npm install
# Then commit the updated lock file
git add package-lock.json
git commit -m "Update package-lock.json"Look for conflict markers:
grep -n "<<<<<<" package-lock.json
grep -n "======" package-lock.json
grep -n ">>>>>>" package-lock.jsonResolve by regenerating lock file.
Different npm versions may create different locks:
# Check your version
npm --version
# Check version in lockfileVersion field
cat package-lock.json | grep lockfileVersionMatch CI to local npm:
# GitHub Actions
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"Ensure lock matches package.json:
# See what differs
npm ls
# After package.json changes, always:
npm install
git add package.json package-lock.json
git commit -m "Add/update dependency"Always commit package-lock.json to version control. Use npm ci in CI/CD for reproducible builds. Different npm versions (especially major versions) may generate incompatible lock files. Consider adding npm version to .nvmrc or engines field. In monorepos with workspaces, workspace lock file must be in sync with all workspace package.json files.
npm notice access token expired or revoked. Please try logging in again.
Token has expired - npm authentication failure
npm ERR! code EAI_AGAIN
How to fix "EAI_AGAIN" in npm
npm error code E403 npm error 403 Forbidden - PUT https://registry.npmjs.org/<package>
How to fix 'E403 Forbidden' error in npm
npm ERR! code EUSAGE npm ERR! Usage error
How to fix "npm ERR! code EUSAGE" in Node.js projects
npm ERR! code E401 npm ERR! 401 Unauthorized
How to fix "E401 Unauthorized" in npm