I have a rails project (rails 6.1 & ruby 3.1.2) which I have deployed to heroku in the past, but now I'm encountering a problem with Heroku. I get the following error:
Counting objects: 80, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (79/79), done.
Writing objects: 100% (80/80), 146.95 KiB | 4.20 MiB/s, done.
Total 80 (delta 54), reused 0 (delta 0)
remote: Updated 9257 paths from fd1836dc
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-22 stack
remote: -----> Using buildpacks:
remote: 1. heroku/nodejs
remote: 2. heroku/ruby
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: USE_YARN_CACHE=true
remote: NODE_VERBOSE=false
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): >=14.15.5
remote: engines.npm (package.json): >=8.0.0
remote: engines.yarn (package.json): >=1.22.19
remote:
remote: Resolving node version >=14.15.5...
remote: Downloading and installing node 21.6.2...
remote: Bootstrapping npm >=8.0.0 (replacing 10.2.4)...
remote: npm 10.5.0 installed
remote: Resolving yarn version >=1.22.19...
remote: Downloading and installing yarn (4.1.0)
remote: Installed yarn 4.1.0
remote:
remote: -----> Installing dependencies
remote: Installing node modules (yarn.lock)
remote: Unknown Syntax Error: Invalid option name ("--production=false").
remote:
remote: $ yarn install [--json] [--immutable] [--immutable-cache] [--refresh-lockfile] [--check-cache] [--check-resolutions] [--inline-builds] [--mode #0]
remote:
remote: -----> Build failed
remote:
remote: We're sorry this build is failing! You can troubleshoot common issues here:
remote: https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote: Some possible problems:
remote:
remote: - Dangerous semver range (>) in engines.node
remote: https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
remote:
remote: Love,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: !
remote: ! ## Warning - The same version of this code has already been built: de7880c51bf729ba0df031b35e79bcf67efe93a7
remote: !
remote: ! We have detected that you have triggered a build from source code with version de7880c51bf729ba0df031b35e79bcf67efe93a7
remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote: !
remote: ! If you are developing on a branch and deploying via git you must run:
remote: !
remote: ! git push heroku <branchname>:main
remote: !
remote: ! This article goes into details on the behavior:
remote: ! https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to ibz-garden-houses.
remote:
To https://git.heroku.com/ibz-garden-houses.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/ibz-garden-houses.git'
What I get from the error that is: Unknown Syntax Error: Invalid option name ("--production=false"). Which I think has something to do with yarn. I've tried to remove the yarn.lock file and generate a new one with yarn install, but that didn't work. I've also removed the YARN: PRODUCTION:FALSE from the Heroku config vars, but that didn't have any effect.
I have no other options at the moment. If someone could help me with this, I'd really appreciate it.
In the end the mistake was in my
package.jsonfile.I had this:
But it should be this:
Now it deploys again to Heroku.