Having followed the 12devs of Xmas tutorial to create my first Node.js app (http://12devsofxmas.co.uk/post/2012-12-28-day-3-realtime-collaborative-drawing-with-nodejs) I'm now attempting to follow Rob Dodson's tutorial for deploying it through Heroku (http://robdodson.me/blog/2012/06/04/deploying-your-first-node-dot-js-and-socket-dot-io-app-to-heroku/)
However, after committing to github, when I attempt to push to Heroku, I get the following error output:
-----> Installing dependencies with npm
npm WARN package.json Draw#0.0.1 No README.md file found!
npm http GET https://registry.npmjs.org/express
npm http 200 https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/express/-/express-2.5.11.tgz
npm http 200 https://registry.npmjs.org/express/-/express-2.5.11.tgz
npm ERR! Refusing to delete: /tmp/build_1t6d7hbd2psal/node_modules/.bin/express not in /tmp/build_1t6d7hbd2psal/node_modules/express
File exists: /tmp/build_1t6d7hbd2psal/node_modules/.bin/express
Move it away, and try again.
npm ERR! System Linux 2.6.32-350-ec2
npm ERR! command "/tmp/node-node-Fenl/bin/node" "/tmp/node-npm-6pyT/cli.js" "install" "--production"
npm ERR! cwd /tmp/build_1t6d7hbd2psal
npm ERR! node -v v0.6.20
npm ERR! npm -v 1.1.65
npm ERR! path /tmp/build_1t6d7hbd2psal/node_modules/.bin/express
npm ERR! code EEXIST
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /tmp/build_1t6d7hbd2psal/npm-debug.log
npm ERR! not ok code undefined
npm ERR! not ok code 1
! Failed to install --production dependencies with npm
! Heroku push rejected, failed to compile Node.js app
To git#heroku.com:secure-dawn-2437.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:secure-dawn-2437.git'
My package.json file is as follows:
{
"name": "Draw",
"version": "0.0.1",
"private": true,
"dependencies": {
"express": "~2.x",
"socket.io": "~0.9.x"
},
"engines": {
"node": "0.6.x",
"npm": "1.1.x"
}
}
I'm sorry - I'm totally new to this sort of development, having mostly worked in Java while in school, but I'm anxious to learn. I assume the problem is somehow with express, but I'm not sure what it means by "move it away, and try again."
Do you have a Procfile file in your application you are trying to deploy?
If not, look at the documentation available on Heroku's Website:
https://devcenter.heroku.com/articles/nodejs#declare-process-types-with-procfile
EDIT:
I highly suggest you to deploy a really simple Node.js application at first (like a Hello World), just so you can trace back the source of your error.
Try removing bin and .bin from your .gitignore or adding node_modules to .gitignore. More info here: Fail to deploy node.js application to heroku
I was able to solve this by temporarily disabling Heroku's use of cache:
heroku config:set NODE_MODULES_CACHE=false
Push the build, then turn cache back on.
Related
help me plis !!! I cant deploy mi mean stack app to heroku
mi git repository with the code:
https://github.com/blinkking349/meanstack
log of error:
-----> Build
Running heroku-postbuild
> meanapp#1.0.0 heroku-postbuild /tmp/build_9dad4ae1_
> NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client
npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "~4.0.2,": Tags may not have any characters that encodeURIComponent encodes.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.3rpWs/_logs/2020-10-18T02_45_15_324Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! meanapp#1.0.0 heroku-postbuild: `NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the meanapp#1.0.0 heroku-postbuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.3rpWs/_logs/2020-10-18T02_45_15_340Z-debug.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
The error message says:
Invalid tag name "~4.0.2,"
It looks like you have included a comma inside your version string for TypeScript in your client directory:
"typescript": "~4.0.2,"
Get rid of it:
"typescript": "~4.0.2"
Then commit and redeploy.
Heroku gives me errors suddenly,
It worked fine for about a month with same settings, yesterday after editing some minor things in the project and uploading to git it gave me error when pushing to heroku master:
Creating an optimized production build...
Failed to compile.
./src/sections/welcome/welcome.css
Error: Didn't get a result from child compiler
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ghvinieri#0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ghvinieri#0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.KO8no/_logs/2019-03-20T10_43_07_497Z-debug.log
-----> 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
Some possible problems:
- Node version not specified in package.json
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 tried putting node version in package.json, deleting package.json, node_modules are included in gitigonre, even tried to copy repo from heroku master which contained older code that works on heroku right now, then editing it and uploading; it still gives error, it makes no sense to me. it works on heroku right now with the same settings though when I upload with a minor change it gives errors. could anyone help me with this? Im stuck, looked up all possible solutions none of them work.
I'm trying to learn how to deploy a Node and Angular app to Heroku and am getting an error.
Here are the steps I'm taking
Create an empty repo on GitHub.
Deploy the pre-create project, which creates a new heroku app.
Next, I download and copy the code that is in the pre-created project.
Then I push that code up to the empty repo I created step 1.
I then go back to Heroku and manually deploy connecting my repo to it.
When deploying I get an error that I don't know how to resolve. This is strange to me since I have the pre-configured Heroku app along with the exact same code.
> Building dependencies
Installing node modules (package.json)
> mean-contactlist-angular2#0.0.0 postinstall /tmp/build_00959509bf83606e9586c85b4acd5130/worldofnick-LocalBeats-34154d74169daf6c8cdab1e9e5407bd4e4f9c24e
> ng build
Cannot read property 'config' of null
TypeError: Cannot read property 'config' of null
at Class.run (/tmp/build_00959509bf83606e9586c85b4acd5130/worldofnick-LocalBeats-34154d74169daf6c8cdab1e9e5407bd4e4f9c24e/node_modules/#angular/cli/tasks/build.js:16:56)
at Class.run (/tmp/build_00959509bf83606e9586c85b4acd5130/worldofnick-LocalBeats-34154d74169daf6c8cdab1e9e5407bd4e4f9c24e/node_modules/#angular/cli/commands/build.js:143:26)
at Class.<anonymous> (/tmp/build_00959509bf83606e9586c85b4acd5130/worldofnick-LocalBeats-34154d74169daf6c8cdab1e9e5407bd4e4f9c24e/node_modules/#angular/cli/ember-cli/lib/models/command.js:134:17)
at process._tickCallback (internal/process/next_tick.js:109:7)
npm ERR! Linux 3.13.0-133-generic
npm ERR! argv "/tmp/build_00959509bf83606e9586c85b4acd5130/worldofnick-LocalBeats-34154d74169daf6c8cdab1e9e5407bd4e4f9c24e/.heroku/node/bin/node" "/tmp/build_00959509bf83606e9586c85b4acd5130/worldofnick-LocalBeats-34154d74169daf6c8cdab1e9e5407bd4e4f9c24e/.heroku/node/bin/npm" "install" "--unsafe-perm" "--userconfig" "/tmp/build_00959509bf83606e9586c85b4acd5130/worldofnick-LocalBeats-34154d74169daf6c8cdab1e9e5407bd4e4f9c24e/.npmrc"
npm ERR! node v6.11.5
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! mean-contactlist-angular2#0.0.0 postinstall: `ng build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mean-contactlist-angular2#0.0.0 postinstall script 'ng build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the mean-contactlist-angular2 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ng build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs mean-contactlist-angular2
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls mean-contactlist-angular2
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /tmp/build_00959509bf83606e9586c85b4acd5130/worldofnick-LocalBeats-34154d74169daf6c8cdab1e9e5407bd4e4f9c24e/npm-debug.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:
- Node version not specified in package.json
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 ran into this problem while deploying to Heroku today. In your package.json, make sure you are correctly specifying node as your engine. Example:
"engines": {
"node": "^8.0.0"
},
I am trying to deploy a simple node.js express-based application to heroku, something which is apparently very basic: https://devcenter.heroku.com/articles/nodejs
Here is my package.json:
{
"name": "cours-lic3-blois",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node app"
},
"dependencies": {
"express": "*",
"ejs": "*",
"github-flavored-markdown": "*",
"less-middleware": "*"
},
"engines": {
"node": "0.8.8",
"npm": "1.1.65"
}
}
When I git push heroku master I got the following trace:
-----> Heroku receiving push
-----> Node.js app detected
-----> Resolving engine versions
Using Node.js version: 0.8.8
Using npm version: 1.1.65
-----> Fetching Node.js binaries
-----> Vendoring node into slug
-----> Installing dependencies with npm
npm ERR! Error: ENOENT, chmod '/tmp/build_1suuxlhd9s8n6/node_modules/express/bin/express'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Linux 2.6.32-348-ec2
npm ERR! command "/tmp/node-node-tonf/bin/node" "/tmp/node-npm-NG88/cli.js" "rebuild"
npm ERR! cwd /tmp/build_1suuxlhd9s8n6
npm ERR! node -v v0.8.8
npm ERR! npm -v 1.1.65
npm ERR! path /tmp/build_1suuxlhd9s8n6/node_modules/express/bin/express
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /tmp/build_1suuxlhd9s8n6/npm-debug.log
npm ERR! not ok code 0
! Failed to rebuild dependencies with npm
! Heroku push rejected, failed to compile Node.js app
To git#heroku.com:fast-everglades-2007.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:fast-everglades-2007.git'
I tried to tweak various versions in my package.json but to no avail. I am developing on windows and it might be possible this ENOENT issue is due to some filemode issue.
I got this fixed by:
Making sure Procfile is committed into git
Removing the node_modules/ folder and committing that into git (git rm -r node_modules/)
Afterwards, I did the git push heroku master then the error disappeared.
I had this problem, and it was because:
I keep node_modules in version control
I had bin in my .gitignore file
npm was attempting to chmod express/bin/express, but due to my .gitignore this file wasn't in git and thus was not being cloned during the deploy, so it failed. I didn't notice it because a local npm install would create the bin/express file as usual.
Removing bin from .gitignore and committing the missing files solved the problem for me.
Heroku team, could you please consider configuring npm to use npm install --no-bin-links --production by default, or creating an environment variable to let users set that flag. This is a serious bug in node installs. Removing the bin directory from my .gitignore (as suggested below) enabled me to deploy, but it breaks using git effectively in a cross-platform development environment, requiring an explicit npm rebuild on every git pull where node_modules might have changed.
NPM best practice is to avoid having node_modules in .gitignore (see http://www.futurealoof.com/posts/nodemodules-in-git.html ).
I believe --no-bin-links will provide the best of both worlds, enabling deploys of node_modules where the bin directory has been excluded, supporting npm rebuild, but not failing when a bin link is created.
I submitted a pull request here: https://github.com/heroku/heroku-buildpack-nodejs/pull/33
Thanks!
similar issue was fixed by renaming gruntfile.js to Gruntfile.js
I had a similar problem a few days ago, I think it was because I imported a module created by me and that was what gave the error;
I corrected it like this:
I called the module "path"
const path = require ("path")
and then where my module was imported I made a join of the file path
const myModule = require (path.join (__ dirname, 'MyModule.js'))
I'm having an issue deploying a restify application to Heroku.
npm ERR! dtrace-provider#0.0.9 install: `node-waf clean ; node-waf configure build`
npm ERR! `sh "-c" "node-waf clean ; node-waf configure build"` failed with 1
npm ERR!
npm ERR! Failed at the dtrace-provider#0.0.9 install script.
npm ERR! This is most likely a problem with the dtrace-provider package,
npm ERR! not with npm itself.
It seems as if Heroku has an issue with dtrace, which restify makes use of, although doesn't require, I've read that you can bypass this by removing dtrace from restify's package.json file, however I have attempted this with no success.
I'm new to node and using Heroku and git so I'm sure there's something I'm missing, restify's package.json file contains the following:
"dependencies": {
"dtrace-provider": "0.0.9",
},
"optionalDependencies": {
"dtrace-provider": "0.0.9"
},
I have removed these lines but still receive the same error message as above after committing to git and pushing to Heroku.
Can anyone see what I'm missing?
When you deploy your application on heroku it installs the dependencies based on your application package.json file so it does not matter if you remove it from restify's package.json file because heroku picks the restify's package.json file from it's repository not from your repository. So, you need to find out how to resolve this error.