Heroku NodeJS Help – Push rejected, no Cedar-supported app detected - node.js

Need help on deploying a nodeJS app to Heroku please. I have my Procfile and Package.son file. This is what I am getting...
remote: Building source: remote:
remote: -----> Fetching custom git
buildpack... done
remote:
remote: ! Push rejected, no Cedar-supported app detected
remote: HINT: This occurs when Heroku cannot detect the build pack
remote: to use for this application automatically.
remote: See https://devcenter.heroku.com/articles/buildpacks
remote:
The message doesn't make sense to me as it says fetching build pack done..what else am I missing? Any suggestions please?
Thanks.

It sounds like you've set a custom buildpack. It's usually best, with node, to just use the official buildpack:
heroku buildpack:unset
Once you set that and push, it won't say "fetching custom buildpack," but rather it will tell you that it detected a node.js app. If it doesn't detect a node.js app, that means that your app is missing its package.json file (lowercase).

I was having the same problem. I fixed it by first removing the custom buildpack I had set using the command:
heroku buildpacks:remove my-buildpack
To see what buildpack you are using you can run the command heroku buildpacks.
I then ran the command npm init to create a package.json file, and committed the changes.
Then to use the official buildpack I ran the command:
heroku buildpacks:set heroku/nodejs
And I was good to go! The error went away. If you already have a package.json you may not need to worry about running npm init, but it worked for me. Heroku talks about this problem in depth here: https://devcenter.heroku.com/articles/troubleshooting-node-deploys

Related

Heroku Node.js npm install failing suddenly

I have never touched my package.json file for as long as my bot has been deployed and I've never had issues deploying my bot on Heroku...until today. Seemingly inexplicably, I'm suddenly getting the following error today when I try to deploy my bot — after having changed nothing about my package.json file and doing nothing to my Heroku cache.
-----> 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): 17.0.1
engines.npm (package.json): 8.49.2
Resolving node version 17.0.1...
Downloading and installing node 17.0.1...
Bootstrapping npm 8.49.2 (replacing 8.1.0)...
Unable to install npm 8.49.2; does it exist?
-----> 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
On a hunch, based on the Stack Overflow article found here, I ran the heroku config:set NODE_MODULES_CACHE=false command for my app, to no avail. I'm still encountering this issue and there appears to be no sign of any successful deployments any time soon.
Any assistance with this would be greatly appreciated.
Typos strike once again. I simply had an invalid version number specified when trying to explicitly call out a version of npm rather than *, fat-fingering a 4 instead of a 1. Thanks go to Chris from the comment above.

Cannot deploy new v4 strapi project to Heroku or Render - getting “401 Unauthorized” error on fontawesome package request

I am trying to create a brand new strapi v4 project and that works fine locally but when I try and deploy it to Render or Heroku (which I’ve done before many times on Strapi v3) I get a build error when it tries to grab fontawesome-free-5.15.4.tgz from fontawesome. The error log I get on both Render and Heroku is:
error An unexpected error occurred: "https://npm.fontawesome.com/#fortawesome/fontawesome-free/-/5.15.4/fontawesome-free-5.15.4.tgz: Request failed \"401 Unauthorized\"".
info If you think this is a bug, please open a bug report with the information provided in "/tmp/build_2d005b2a/yarn-error.log".
Is there something I can do to solve the issue? If I go to https://npm.fontawesome.com/#fortawesome/fontawesome-free/-/5.15.4/fontawesome-free-5.15.4.tgz myself, it asks for a username and password so I’m assuming that when Render/Heroku try and hit that URL they don’t have a username and password to send. (And the same goes for all the different npm.fontawesome.com links in the yarn.lock file).
If this is the case, why does the project build and run fine locally? Shouldn’t I also have to input those credentials? Do they need to be added as environment variables on Render/Heroku somehow?
Sorry, I’m quite new to all this! I was following this tutorial on the Strapi blog: https://strapi.io/blog/deploying-a-strapi-api-on-heroku
Any help is greatly appreciated.
Thanks!
P.S. Here is the full error log from Heroku:
-----> Building on the Heroku-20 stack
-----> Determining which buildpack to use for this app
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
USE_YARN_CACHE=true
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): >=12.x.x <=16.x.x
engines.npm (package.json): >=6.0.0
engines.yarn (package.json): unspecified (use default)
Resolving node version >=12.x.x <=16.x.x...
Downloading and installing node 16.14.1...
Bootstrapping npm >=6.0.0 (replacing 8.5.0)...
npm >=6.0.0 installed
Resolving yarn version 1.22.x...
Downloading and installing yarn (1.22.17)
Installed yarn 1.22.17
-----> Installing dependencies
Installing node modules (yarn.lock)
yarn install v1.22.17
[1/4] Resolving packages...
[2/4] Fetching packages...
error An unexpected error occurred: "https://npm.fontawesome.com/#fortawesome/fontawesome-free/-/5.15.4/fontawesome-free-5.15.4.tgz: Request failed \"401 Unauthorized\"".
info If you think this is a bug, please open a bug report with the information provided in "/tmp/build_2d005b2a/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
-----> 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

i got this error when i tried to git push | [ErrorException] : composer failed

I have been following this tutorial (Tutorial: Build a PHP and MySQL app in Azure App Service) https://learn.microsoft.com/en-us/azure/app-service/tutorial-php-mysql-app?pivots=platform-linux#deploy-to-azure
the problem is when i try to git push git push azure master
i get this error.
remote: Loading composer repositories with package information
remote: Installing dependencies (including require-dev) from lock file
remote:
remote:
remote: An error has occurred during web site deployment.
remote: [ErrorException]
remote: composer failed
remote: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
remote:
remote:
remote: install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...
remote:
remote: Deployment Logs : 'https://larave-tasks.scm.azurewebsites.net/newui/jsonviewer?view_url=/api/deployments/dae345ee76d1755cfccd62004c6fc0c472fed981/log'
To https://larave-tasks.scm.azurewebsites.net/larave-tasks.git
* [new branch] master -> master
Can someone help me solve this error ...
The laravel-tasks project is four years old. That project requires Laravel 5.4 and PHP 5.6. Both are old. The current mainstream PHP version is 7.4. Laravel is version 8.
The azure command is specifying PHP 7.2 which is not supported by the project.
You will need to download the project to your local system, patch and update, and then deploy with the patched version. The error that you have is caused by incompatibilities with composer. You will need to run composer update which will fail.
Unless you are experienced with Laravel and PHP pick a different project to learn from.

Node.js application not detected by Heroku

I created a small site in Visual Studio and used Node.js and Express. I can access it via Visual Studio and with Heroku local web. However, when trying to push it to Heroku, I get the error: Application not supported by 'heroku/nodejs' buildpack
I read through the documentation provided by Heroku, but didn't find any solution.
ERROR: Application not supported by 'heroku/nodejs' buildpack
remote: !
remote: ! The 'heroku/nodejs' buildpack is set on this application, but was
remote: ! unable to detect a Node.js codebase.
remote: !
remote: ! A Node.js app on Heroku requires a 'package.json' at the root of
remote: ! the directory structure.
remote: !
remote: ! If you are trying to deploy a Node.js application, ensure that this
remote: ! file is present at the top level directory. This directory has the
remote: ! following files:
remote: !
remote: ! Portfolio/
remote: ! Portfolio.sln
remote: !
remote: ! If you are trying to deploy an application written in another
remote: ! language, you need to change the list of buildpacks set on your
remote: ! Heroku app using the 'heroku buildpacks' command.
remote: !
remote: ! For more information, refer to the following documentation:
remote: ! https://devcenter.heroku.com/articles/buildpacks
remote: ! https://devcenter.heroku.com/articles/nodejs-support#activation
This error output is pretty straightforward - make sure your package.json is in the top level directory for your project and try deploying again. Based on your comment, it seems that package.json is located at {project_root}/Portfolio/package.json instead of {project_root}/package.json.
Look at this error message.
A Node.js app on Heroku requires a 'package.json' at the root of the directory structure.
Do your package.json is on root directory ?

Custom node.js version on Openshift

I am having trouble running custom node version on node0.10 cartridge on open shift which you can find here.
I get to install the new node version just great, however open shift keeps using the old node 10.25.
Deoploy log:
remote: Activating deployment
remote: - Checking to see if Node.js version 0.10.33 is installed ...
remote: - Node.js version 0.10.33 is already installed
remote:
remote: - pre_start_nodejs: Adding Node.js version 0.10.33 binaries to path
remote: -this is the path: /var/lib/openshift/54b6ea6e4382ece151000039/app-root/data/node-v0.10.33-linux-x64/bin:/var/lib/openshift/54b6ea6e4382ece151000039/app-root/runtime/repo/node_modules/.bin:/var/lib/openshift/54b6ea6e4382ece151000039//.node_modules/.bin:/opt/rh/nodejs010/root/usr/bin:/bin:/usr/bin:/usr/sbin
remote: - PATH set to include custom node version (0.10.33) from
remote: /var/lib/openshift/54b6ea6e4382ece151000039/app-root/data/node-v0.10.33-linux-x64/bin
remote: PATH = /var/lib/openshift/54b6ea6e4382ece151000039/app-root/data/node-v0.10.33-linux-x64/bin:/var/lib/openshift/54b6ea6e4382ece151000039/app-root/runtime/repo/node_modules/.bin:/var/lib/openshift/54b6ea6e4382ece151000039//.node_modules/.bin:/opt/rh/nodejs010/root/usr/bin:/bin:/usr/bin:/usr/sbin
remote: Starting NodeJS cartridge
Everything looks great and awesome, until I run the app which says: 10.25...
rhc tail:
v0.10.25
/opt/rh/nodejs010/root/usr/bin:/opt/rh/v8314/root/usr/bin:/var/lib/openshift/54b6feb9e0b8cd56c00000e1/app-root/data/node-v0.10.33-linux-x64/bin:/var/lib/openshift/54b6feb9e0b8cd56c00000e1/app-root/runtime/repo/node_modules/.bin:/var/lib/openshift/54b6feb9e0b8cd56c00000e1//.node_modules/.bin:/opt/rh/nodejs010/root/usr/bin:/bin:/usr/bin:/usr/sbin
undefined
Even when i rhc ssh to my app and try node -v i get 10.33...
on start time the PATH env gets overwritten and causes node to use the old bins...
PS: I am trying to deploy a Meteor app (1.0.2.1)
Nevermind, figured it out :-)
If you want to use custom node #openshift take a look at this repo.
Hope I get to help someone!

Resources