HAPPYHACKING/ERROR SOLVED
<Solved> Heroku "npm ERR! Missing: '' from lock file" error
SPSP
2024. 7. 13. 11:16
Heroku building error
-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/nodejs
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): 16.x
engines.npm (package.json): unspecified (use default)
Resolving node version 16.x...
Downloading and installing node 16.16.0...
Using default npm version: 8.11.0
-----> Restoring cache
Cached directories were not restored due to a change in version of node, npm, yarn or stack
Module installation may take longer for this build
-----> Installing dependencies
Installing node modules
npm ERR! code EUSAGE
npm ERR!
npm ERR! `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.
npm ERR!
npm ERR! Invalid: lock file's ajv@6.12.6 does not satisfy ajv@8.11.0
npm ERR! Missing: ajv@6.12.6 from lock file
npm ERR! Invalid: lock file's json-schema-traverse@0.4.1 does not satisfy json-schema-traverse@1.0.0
npm ERR! Missing: ajv@6.12.6 from lock file
npm ERR! Missing: react-tooltip@4.2.21 from lock file
npm ERR! Missing: uuid@7.0.3 from lock file
npm ERR! Missing: ajv@6.12.6 from lock file
npm ERR! Missing: ajv-keywords@3.5.2 from lock file
npm ERR! Missing: json-schema-traverse@0.4.1 from lock file
npm ERR! Missing: ajv@6.12.6 from lock file
npm ERR! Missing: ajv-keywords@3.5.2 from lock file
npm ERR! Missing: json-schema-traverse@0.4.1 from lock file
npm ERR! Missing: json-schema-traverse@0.4.1 from lock file
npm ERR! Missing: ajv@6.12.6 from lock file
npm ERR! Missing: ajv-keywords@3.5.2 from lock file
npm ERR! Missing: json-schema-traverse@0.4.1 from lock file
npm ERR! Missing: json-schema-traverse@0.4.1 from lock file
npm ERR!
npm ERR! Clean install a project
npm ERR!
npm ERR! Usage:
npm ERR! npm ci
npm ERR!
npm ERR! Options:
npm ERR! [--no-audit] [--foreground-scripts] [--ignore-scripts]
npm ERR! [--script-shell <script-shell>]
npm ERR!
npm ERR! aliases: clean-install, ic, install-clean, isntall-clean
npm ERR!
npm ERR! Run "npm help ci" for more info
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.tXPks/_logs/2022-07-19T04_02_49_403Z-debug-0.log
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
If you're stuck, please submit a ticket so we can help:
https://help.heroku.com/
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
Solution
install missing dependencies
In my case, I installed 'ajv', 'react-tooltip', and 'uuid'
npm ajv
npm react-toolti
npm uuid
and then re-commit and push to heroku
git add .
git commit -am 'try to fix deploy error'
git push heroku main
728x90