install on Heroku fails #35

Closed
ethul opened this Issue Jul 14, 2012 · 23 comments

6 participants

@ethul

Hi All,

I am using the node-neo4j package on a project that I am hosting on Heroku. Upon pushing the project, it fails on the post-install step of node-neo4j. However, the package installs just fine on my local machine, so I am not sure if there is an actual issue here. Alternatively, I am thinking that there could be an issue with the buildpack, or with the specific versions of Node.js (v0.8.2) and NPM (v1.1.39) I am using on Heroku.

I will continue to investigate the problem, but if anyone has seen this before, or knows what might be going on, that would be most helpful.

Please find the Heroku output below.

Best,
-Eric

> neo4j@0.2.13 postinstall /tmp/build_20zj9urr4tkew/node_modules/neo4j
> npm run build

sh: npm: not found
npm http GET https://registry.npmjs.org/crc/0.2.0
npm http GET https://registry.npmjs.org/mime/1.2.6
npm ERR! neo4j@0.2.13 postinstall: `npm run build`
npm ERR! `sh "-c" "npm run build"` failed with 127
npm ERR! 
npm ERR! Failed at the neo4j@0.2.13 postinstall script.
npm ERR! This is most likely a problem with the neo4j package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run build
npm ERR! You can get their info via:
npm ERR!     npm owner ls neo4j
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 2.6.32-343-ec2
npm ERR! command "/tmp/node-node-oFAf/bin/node" "/tmp/node-npm-vcxz/cli.js" "install" "--production"
npm ERR! cwd /tmp/build_20zj9urr4tkew
npm ERR! node -v v0.8.2
npm ERR! npm -v 1.1.39
npm ERR! code ELIFECYCLE
npm ERR! message neo4j@0.2.13 postinstall: `npm run build`
npm ERR! message `sh "-c" "npm run build"` failed with 127
@aseemk
The Thingdom member

This was quite tricky, but I realize what's going on!

> neo4j@0.2.13 postinstall /tmp/build_20zj9urr4tkew/node_modules/neo4j
> npm run build

sh: npm: not found

Heroku doesn't come with npm available to npm scripts. Very strange this way. We use npm in multiple ways during our top-level app's install scripts, so we had worked around this by simply adding npm as a dependency itself.

This lib should absolutely work on Heroku without workarounds, so I'll fix this. In the meantime, would you be able to simply add npm as a dependency to your project?

I'll also bug Heroku to ask why npm isn't available. Thanks for reporting!

@ethul ethul added a commit to ethul/oregano that referenced this issue Jul 14, 2012
@ethul ethul Adding NPM as a dependency
This is the workaround suggested in the issue thingdom/node-neo4j#35
where NPM was being used by the package but is not included on Heroku by
default.

Once this issue is resolved, the dependency will be removed.
715800c
@ethul

Great! Your suggestion worked like a charm.

Thanks,
-Eric

@aseemk
The Thingdom member

Hey @ethul, this seems to be fixed for me. Can you test it from your app too? (By removing the explicit npm dependency and redeploying.) Thanks!

@ethul

Thanks @aseemk I will test this on my next deploy and report back.

@ethul

Hi @aseemk, I just ran a deploy and still see the error.

@ethul ethul added a commit to ethul/oregano that referenced this issue Sep 9, 2012
@ethul ethul Adding NPM as a depedency
The NPM module has been re-added as a dependency regarding issue
thingdom/node-neo4j#35 because it seems the module is still required.
This will be re-tested and removed when the issue is resolved.
4681d4f
@aseemk
The Thingdom member

Thanks for testing @ethul! Okay, I'll continue working with Heroku to fix this.

@ethul

Welcome @aseemk, keep me posted. I am happy to re-test.

@aseemk aseemk was assigned Sep 11, 2012
@athieriot

Hi everyone,

I encounter exactly the same error on Heroku with the version 0.2.19 or node-neo4j

  sh: npm: not found
  npm ERR! neo4j@0.2.19 postinstall: `npm run build`
  npm ERR! `sh "-c" "npm run build"` failed with 127

Any news?

Thank you very much

@aseemk
The Thingdom member

Sorry @athieriot, I haven't made time to do this yet. You're aware of the workaround mentioned above, of simply adding npm as a dependency in your package.json, yes?

@athieriot

Yeah the temporary fix is working anyway :) Thank you.

After looking around, though, I think it should be fix in the corresponding Heroku buildpack.
There is a reported issue and a pending Pull Request on the project.

Let's see how that goes.

@aseemk
The Thingdom member

Yes, it's indeed Heroku's Node.js buildpack that should be fixed. Great to hear the workaround works for now!

@flipside

Personally, I think precompiling the javascript in the next version submitted to npm and removing the build command would be simplest.

@athieriot

Hi !

Just to warn you that it seems the workaround is not working anymore with Node.js 0.10.x

@aseemk
The Thingdom member

Sorry for the delay in responding, @athieriot, but yes, you're right! Looking into this now.

@flipside: you might be right. =)

@aseemk aseemk added a commit that closed this issue Apr 17, 2013
@aseemk aseemk Simplify build; precompile to JS on publish now.
Fixes #35 also (installing on Heroku with Node 0.10).

I had originally considered this and went with compile-on-install so that
the CoffeeScript and Streamline compiler dependencies could be treated like
other dependencies -- use the best matching version at installation time
instead of effectively "freezing" those dependencies by compiling at publish
time -- but it seems this does simplify things. One less moving part at
deploy time for users. I can dig that.

Thanks @flipside for the nudge!
125502b
@aseemk aseemk closed this in 125502b Apr 17, 2013
@aseemk
The Thingdom member

Okay, fixed as @flipside recommended; installation of this library now works on Heroku out-of-the-box even with Node 0.10. Thanks for the heads-up @athieriot!

@athieriot

Really great!

Thank you

@aseemk
The Thingdom member

No prob at all.

Forgot to mention: this pre-compiled version is published on npm as 0.2.20 now, so be sure to update your package.json and/or npm-shrinkwrap.json if you need to.

@zishon89us

@aseemk problem still continues on heroku;
I just tried it one machine with 0.2.20 and included npm as dependency then it worked

@aseemk
The Thingdom member

Very strange @zishon89us. You shouldn't have had to do that, but it's good that at least it's working for now. If you're still interested in figuring out the issue, let me know. Otherwise, let me know if it stops working again.

@zishon89us

@aseemk I would try it on other machine, will update you soon.

@sonoman

Hi there:
I'm having the same problem, only that in my case, I'm trying to execute a "preinstall" script, calling "npm install ./src/" to build a package that's below my package root....so i don't know how could i add npm as dependency......

npm install ./src/
sh: npm: not found
npm ERR! mypackage@1.2.10 preinstall: npm install ./src/

Any help will be very much appreciated

@aseemk
The Thingdom member

@sonoman: you're having the same problem, meaning node-neo4j won't install on Heroku for you?

Or do you mean you're seeing a similar error unrelated to node-neo4j? The error sh: npm not found refers to the fact that npm isn't installed globally on Heroku at build-time. So adding it as a dependency means adding it to your package.json. E.g.:

"dependencies": {
    "npm": "1.x"
}
@sonoman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment