Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm ci fails when installing via Deploy to Heroku button #316

Open
thebbennett opened this issue May 5, 2022 · 10 comments
Open

npm ci fails when installing via Deploy to Heroku button #316

thebbennett opened this issue May 5, 2022 · 10 comments
Labels
bug Something isn't working

Comments

@thebbennett
Copy link

thebbennett commented May 5, 2022

Context (Environment)

Heroku (Deploy to Heroku button)

Expected Behavior

npm ci succeeds when deploying to Heroku

Actual Behavior

npm ci fails when deploying to Heroku, due to a discrepancy between the package.json and package-lock.json

To Reproduce

Click the Deploy to Heroku button and enter all required environment variables

Possible Solution

Running npm install and pushing an updated package-lock.json

@thebbennett thebbennett added the bug Something isn't working label May 5, 2022
@lenay12
Copy link

lenay12 commented May 15, 2022

I believe the issues is exactly as the error message states: package-lock.json is out of sync with package.json.

Steps to fix: rm package-lock.json, and then recreate the file using the following command npm i --package-lock-only (see reference here: https://www.codegrepper.com/code-examples/javascript/what+is+package-lock.json)

@lenay12
Copy link

lenay12 commented May 15, 2022

Upon further investigation AND attempting to get a fix in place, I think this isn't actually package-lock issue. I suspect what's happening is related to a security incident. For more info see here: https://status.heroku.com/incidents/2413

@lsmolic
Copy link

lsmolic commented May 15, 2022

Thank you for looking into this @lenay12 ... I finally get around to setting this up and .... blocked by salesforce. Please let me know if you come up with a solve.

@lenay12
Copy link

lenay12 commented May 19, 2022

@lsmolic My solution for this had been to deploy it with the Google App Engine. I found the task trickier than it looks because the instructions available here were not comprehensive. I'm currently working on the demo of the site and haven't set it up for real. I plan to write something up when I go through it the second time, which may be a while. If you end up trying to do it yourself feel free to @ me from the Library Google Group. It did work eventually, but I had to make adjustments to the package.json, change the format of the .env file from what's recommended in the instructions and add google data store to house the read history the app uses.

@drewx0r
Copy link

drewx0r commented May 29, 2022

Was a fix ever found for this? I'm still getting the npm ci error when trying to deploy via the provided deploy button.

@lenay12
Copy link

lenay12 commented May 29, 2022

@drewx0r did you look at the link I provided above for the status of heroku? The issue isn't with this application it's with heroku, so the fix is to deploy the app using other means (listed in the readme).

@drewx0r
Copy link

drewx0r commented May 29, 2022

Got it. I wasn’t clear from the Heroku status page whether or not they’d resolved things partially or fully. Thanks for clarifying!

@lenay12
Copy link

lenay12 commented May 29, 2022

Oh, you're right there's a fresh update from 4 days ago, it does look like it should have been resolved. Either way, my solution was to deploy using google cloud platform. you get a little more control over what you're doing, because troubleshooting someone else's deploy button is pretty tough :)

@ublackman
Copy link

ublackman commented Sep 29, 2022

I just tried to deploy via Heroku and it failed with the same error. Pasted below.
Any ideas?

-----> Building on the Heroku-22 stack
-----> Determining which buildpack to use for this app
-----> 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): >=10.x
engines.npm (package.json): >=6.5.x

   Resolving node version >=10.x...
   Downloading and installing node 18.10.0...
   Bootstrapping npm >=6.5.x (replacing 8.19.2)...
   npm 8.19.2 installed

-----> 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! Missing: [email protected] 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! [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
npm ERR! [-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling]
npm ERR! [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
npm ERR! [--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
npm ERR! [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
npm ERR! [-w|--workspace [-w|--workspace ...]]
npm ERR! [-ws|--workspaces] [--include-workspace-root] [--install-links]
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.jPIPu/_logs/2022-09-29T02_43_27_953Z-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
   
   Some possible problems:
   
   - Dangerous semver range (>) in engines.node
     https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
   
   Love,
   Heroku

! Push rejected, failed to compile Node.js app.
! Push failed

@ublackman
Copy link

I solved this problem by deploying on Google Cloud and updating the files for the node.js version from 10 to 16.
specifically:

package.json:

"engines": {
"node": ">=16.0",
"npm": ">=6.5.x"
},

and in app.yaml

runtime: nodejs16
instance_class: F4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants