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
He
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.
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!
I had this problem, and it was because:
node_modules
in version controlbin
in my .gitignore filenpm
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.
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'))
similar issue was fixed by renaming gruntfile.js to Gruntfile.js