I made one tiny text change to an old(er) Node application which works as intended in my local development system, including the npm ci command, but it fails to deploy to Heroku with this error:
npm ERR! The `npm ci` command can only install with an existing package-lock.json or
remote npm-shrinkwrap.json with lockfileVersion >= 1
but I have a package-lock.json with:
"lockfileVersion": 2,
This application used to deploy just fine but it's been a year of two since the last deploy so I'm guessing this is some underlying issue with the Heroku deployment, perhaps with the updated build-packs. The application is currently using heroku-18 but it's trying to upgrade to heroku-22 in the same deploy.
I've tried different versions of Node and NPM though I can't go above Node 12 without making significant updates to this legacy application...which I'd r e a a a l l y like to avoid.
Any ideas on how to tickle this away?
Full Error
remote: Building source:
remote:
remote: -----> Building on the Heroku-22 stack
remote: -----> Using buildpack: heroku/nodejs
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NODE_VERBOSE=false
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): 15.3.0
remote: engines.npm (package.json): 7.0.14
remote:
remote: Resolving node version 15.3.0...
remote: Downloading and installing node 15.3.0...
remote: npm 7.0.14 already installed with node
remote:
remote: -----> Restoring cache
remote: Cached directories were not restored due to a change in version of node, npm, yarn or stack
remote: Module installation may take longer for this build
remote:
remote: -----> Prebuild
remote: Running heroku-prebuild
remote:
remote: > snazzywiz@2.1.1 heroku-prebuild
remote: > npm --global install pushstate-server@3.0.1; npm --global install @angular/cli
remote:
remote:
remote: added 44 packages, and audited 44 packages in 3s
remote:
remote: 10 vulnerabilities (5 low, 3 moderate, 2 high)
remote:
remote: To address issues that do not require attention, run:
remote: npm audit fix
remote:
remote: To address all issues, run:
remote: npm audit fix --force
remote:
remote: Run `npm audit` for details.
remote:
remote: added 209 packages, and audited 209 packages in 8s
remote:
remote: 25 packages are looking for funding
remote: run `npm fund` for details
remote:
remote: found 0 vulnerabilities
remote: npm notice
remote: npm notice New major version of npm available! 7.0.14 -> 8.19.2
remote: npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.19.2>
remote: npm notice Run `npm install -g npm@8.19.2` to update!
remote: npm notice
remote:
remote: -----> Installing dependencies
remote: Installing node modules
remote: npm ERR! The `npm ci` command can only install with an existing package-lock.json or
remote: npm ERR! npm-shrinkwrap.json with lockfileVersion >= 1. Run an install with npm@5 or
remote: npm ERR! later to generate a package-lock.json file, then try again.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.ULXke/_logs/2022-09-17T19_15_54_600Z-debug.log
remote:
remote: -----> Build failed
Note: There are several SO questions with the same "The npm ci command can only..." error message but triggered from different scenarios but none from just a deploy to Heroku.