I forked node-js-sample and made just added index.htm with some content
When I click the button "Doploy to heroku" app fails to build with following error:
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_ENV=production
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
-----> Installing binaries
engines.node (package.json): 4.0.0
engines.npm (package.json): unspecified (use default)
Resolving node version 4.0.0...
Downloading and installing node 4.0.0...
Detected package-lock.json: defaulting npm to version 5.x.x
Bootstrapping npm 5.x.x (replacing 2.14.2)...
npm 5.x.x installed
ERROR: npm is known not to run on Node.js v4.0.0
Node.js 4 is supported but the specific version you're running has
a bug known to break npm. Please update to at least 4.7.0 to use this
version of npm. You can find the latest release of Node.js at
https://nodejs.org/
ERROR: npm is known not to run on Node.js v4.0.0
Node.js 4 is supported but the specific version you're running has
a bug known to break npm. Please update to at least 4.7.0 to use this
version of npm. You can find the latest release of Node.js at
https://nodejs.org/
ERROR: npm is known not to run on Node.js v4.0.0
Node.js 4 is supported but the specific version you're running has
a bug known to break npm. Please update to at least 4.7.0 to use this
version of npm. You can find the latest release of Node.js at
https://nodejs.org/
-----> Change to Node.js build process
Heroku has begun executing the "build" script defined in package.json
during Node.js builds.
Read more: https://devcenter.heroku.com/changelog-items/1573
-----> 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
From what I understand heroku try to runs my code with incorrect version of node.js, but why?
The repository hasn't been updated in 4 or more years and still depend on node.js 4 and lists the same on the package.json. It is a compatibility issue, before deploying change it to 6.0.0 and try, you might have luck.
Ran into the same issue recently which was a real pain, found a solution here https://devcenter.heroku.com/articles/nodejs-support
Currently, supported versions are 10.x, 12.x, 13.x, and 14.x.
You should always specify a Node.js version that matches the runtime
you’re developing and testing with.
Updated node globally and specified the engine in package.json like:
"engines": {
"node": "10.20.x"
},
Hope this helps someone
Related
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.
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 am using a private package from GitHub. When attempting to deploy, Heroku ignores my .npmrc file configs.
Locally, my environment file looks like:
NPM_CONFIG_GITHUB_TOKEN=[token]
Then, my .npmrc file looks like this:
[username]:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=$GITHUB_TOKEN
With this configuration, I'm able to run this locally just fine. In Heroku, I get the following error:
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NPM_CONFIG_GITHUB_TOKEN=[token]
NODE_ENV=production
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
-----> Installing binaries
engines.node (package.json): 12.13.x
engines.npm (package.json): unspecified (use default)
Resolving node version 12.13.x...
Downloading and installing node 12.13.1
Using default npm version: 6.12.1
-----> 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 E401
npm ERR! 401 Unauthorized - GET https://npm.pkg.github.com/download/[package]
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.P5iPk/_logs/2020-08-03T18_44_16_744Z-debug.log
-----> Build failed
The full logs say the same thing. However, if I change .npmrc to:
[username]:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
... It work just fine in Heroku, but breaks locally.
Can anyone offer some guidance on what I'm doing wrong here? I've researched this for hours with no success. While the obvious solution is a different local version, this is an opensource project and I want to be able to provide straightforward installation directions.
When I deploy to Heroku I usually set the environment variables in my app settings on Heroku and I've never had a problem, you could try that
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!
I'm deploying a Node app to Heroku and get the following error. If npm doesn't work with recent versions of Node, what are we supposed to use for a package manager? I really liked node_modules and package.json. It seemed very logical.
-----> Heroku receiving push
-----> Node.js app detected
-----> Resolving engine versions
Using Node.js version: 0.8.5
Using npm version: 1.0.106
-----> Fetching Node.js binaries
-----> Vendoring node into slug
-----> Installing dependencies with npm
Error: npm doesn't work with node v0.8.5
Required: node#0.4 || 0.5 || 0.6
If you're specifying Node.js 0.8.x via "engines" in your package.json, you may also need to set a version for "npm":
{
...
"engines": {
"node": "0.8.x",
"npm": "1.1.x"
}
}
From the Heroku Dev Center for Node.js:
If you do not specify a version, you will get the following defaults:
Node.js: 0.4.7
npm: 1.0.106
That page also includes links to supported version manifests for both.
You've simply got an obsolete version of npm: the current version is 1.1.45 and works just fine with 0.8.x versions of node.