The workflow fails at the 'npm ci' step complaining that package-lock.json is out of sync with package.json, even though the build works fine locally.
Keep package-lock.json committed and in sync, and pin the same Node.js version in CI that's used locally.
Step-by-Step Guide
Run npm install locally and commit the updated package-lock.json if it drifted
Pin the exact Node version with actions/setup-node, matching the local .nvmrc
Use npm ci instead of npm install in CI for fully reproducible builds
Cache node_modules using actions/cache keyed on the package-lock.json hash
Check for OS-specific native dependencies that behave differently on Ubuntu runners
Add a build step before tests to catch build errors earlier in the pipeline
Review the full Actions log, not just the summary, for the exact npm error message
Found an issue with this solution?