arunoda / meteor-up-legacy

Production Quality Meteor Deployments
MIT License
2.26k stars 395 forks source link

Deploy from MAC to Linux - "bcrypt_lib.node: invalid ELF header" #377

Closed nchokoev closed 9 years ago

nchokoev commented 9 years ago

Hello,

I'm trying to deploy a meteor app from MAC OS to Linux.

The deployment fails: ✘ Invoking deployment process: FAILED

with log: ...app/programs/server/npm/npm-bcrypt/node_modules/bcrypt/build/Release/bcrypt_lib.node: invalid ELF header

It looks like MUP is uploading the local MAC bcrypt. I'm not sure if MUP does build bcrypt on the target Linux machine, and if it does it probably doesn't clean-up the old (MAC) binaries.

If I go to the Linux machine and I do: cd ...app/programs/server rm -rf npm/npm-bcrypt/node_modules/bcrypt npm install bcrypt

then I can start service and all works.

Strangely If I don't delete the bcrypt and just do: cd ...app/programs/server npm install bcrypt it doesn't work. I tried to rebuild bcrypt, etc. - no success until I delete the old binaries.

Is there an easy fix for it? Am I doing something wrong or I'm missing something...?

joaopiopedreira commented 9 years ago

Hi,

Try this:

If the problem persists, copy/paste your mup.json file here together with the full error stack. Also, it would help to know the Meteor version you're running.

Enviado do meu iPhone

No dia 15/04/2015, às 21:25, nickich notifications@github.com escreveu:

Hello,

I'm trying to deploy a meteor app from MAC OS to Linux.

The deployment fails: ✘ Invoking deployment process: FAILED

with log: ...app/programs/server/npm/npm-bcrypt/node_modules/bcrypt/build/Release/bcrypt_lib.node: invalid ELF header

It looks like MUP is uploading the local MAC bcrypt. I'm not sure if MUP does build bcrypt on the target Linux machine, and if it does it probably doesn't clean-up the old (MAC) binaries.

If I go to the Linux machine and I do: cd ...app/programs/server rm -rf npm/npm-bcrypt/node_modules/bcrypt npm install bcrypt

then I can start service and all works.

Strangely If I don't delete the bcrypt and just do: cd ...app/programs/server npm install bcrypt it doesn't work. I tried to rebuild bcrypt, etc. - no success until I delete the old binaries.

Is there an easy fix for it? Am I doing something wrong or I'm missing something...?

— Reply to this email directly or view it on GitHub.

nchokoev commented 9 years ago

Hi,

On the MAC: The Meteor version is: Meteor 1.1.0.1 MUP is updated.

On the target node version is: v0.10.38.

The upstart log is (beginning and end of it, rest is repeated...):

/opt/myapp/app/programs/server/node_modules/fibers/future.js:245 throw(ex); ^ Error: /opt/myapp/app/programs/server/npm/npm-bcrypt/node_modules/bcrypt/build/Release/bcrypt_lib.node: invalid ELF header at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at bindings (/opt/myapp/app/programs/server/npm/npm-bcrypt/node_modules/bcrypt/node_modules/bindings/bindings.js:74:15) at Object. (/opt/myapp/app/programs/server/npm/npm-bcrypt/node_modules/bcrypt/bcrypt.js:3:35) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) error: Forever detected script exited with code: 8 error: Script restart attempt #1

......

/opt/myapp/app/programs/server/node_modules/fibers/future.js:245 throw(ex); ^ Error: Cannot find module './middleware/compress' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364:17) at require (module.js:380:17) at Function.load as compress at runWebAppServer (packages/webapp/webapp_server.js:575:1) at Package (packages/webapp/webapp_server.js:763:1) at /opt/myapp/app/programs/server/packages/webapp.js:818:4 at /opt/myapp/app/programs/server/packages/webapp.js:829:3 at /opt/myapp/app/programs/server/boot.js:222:10 error: Forever detected script exited with code: 8

stepping down to gid: meteoruser stepping down to uid: meteoruser

Thanks.

joaopiopedreira commented 9 years ago

Try to downgrade your node version to 0.10.36 in the target by specifying it in your mup.json file.

Should work!

Enviado do meu iPhone

No dia 16/04/2015, às 19:25, nickich notifications@github.com escreveu:

Hi,

On the MAC: The Meteor version is: Meteor 1.1.0.1 MUP is updated.

On the target node version is: v0.10.38.

The upstart log is (beginning and end of it, rest is repeated...):

/opt/myapp/app/programs/server/node_modules/fibers/future.js:245 throw(ex); ^ Error: /opt/myapp/app/programs/server/npm/npm-bcrypt/node_modules/bcrypt/build/Release/bcrypt_lib.node: invalid ELF header at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at bindings (/opt/myapp/app/programs/server/npm/npm-bcrypt/node_modules/bcrypt/node_modules/bindings/bindings.js:74:15) at Object. (/opt/myapp/app/programs/server/npm/npm-bcrypt/node_modules/bcrypt/bcrypt.js:3:35) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) error: Forever detected script exited with code: 8 error: Script restart attempt #1

......

/opt/myapp/app/programs/server/node_modules/fibers/future.js:245 throw(ex); ^ Error: Cannot find module './middleware/compress' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364:17) at require (module.js:380:17) at Function.load as compress at runWebAppServer (packages/webapp/webapp_server.js:575:1) at Package (packages/webapp/webapp_server.js:763:1) at /opt/myapp/app/programs/server/packages/webapp.js:818:4 at /opt/myapp/app/programs/server/packages/webapp.js:829:3 at /opt/myapp/app/programs/server/boot.js:222:10 error: Forever detected script exited with code: 8

stepping down to gid: meteoruser stepping down to uid: meteoruser

Thanks.

— Reply to this email directly or view it on GitHub.

nchokoev commented 9 years ago

Hello João,

Your suggestion seems to do the trick. Thanks! So far it works great.

Thanks. Nikolay

joaopiopedreira commented 9 years ago

Glad I could help :-)

On 17 April 2015 at 18:54, nickich notifications@github.com wrote:

Closed #377 https://github.com/arunoda/meteor-up/issues/377.

— Reply to this email directly or view it on GitHub https://github.com/arunoda/meteor-up/issues/377#event-284115502.

vincro commented 8 years ago

Still seeing this with deployment from OSx to Ubuntu with .36-.43 in Meteor 1.3.
All manner of setup/deploy and npm command do not seem to work. Is this merely an OSX to Ubuntu issue?

piyushcoader commented 8 years ago

@vincro same here facing same issue with deploying Meteor 1.3

mlecoq commented 8 years ago

@piyushcoader same issue for me since I have upgraded to Meteor 1.3

vincro commented 8 years ago

I have resorted to doing my own deploys on DigitalOcean and writing my own deploys using flightplans, not ideal but less of a black box and ultimate flexibility.

piyushcoader commented 8 years ago

I think the issue is with new meteor build system meteor build --architecture targetArch and i think can be solved by updating the build but i did by manual deploying

mlecoq commented 8 years ago

I have manually updated the bcrypt dependency

app/programs/server/npm/node_modules/meteor/npm-bcrypt/node_modules/bcrypt from 0.7.8 to 0.8.5 directly on my server

TheRealmGaming commented 8 years ago

@mlecoq How did you manually update bcrypt? It's definitely what's breaking my app.

Incidentally, is there a way to delete bcrypt from your app and re-add it now npm is supported?

mlecoq commented 8 years ago

@TheRealmGaming I am not very proud of it :)

In the following directory :

/opt/myapp/app/programs/server/npm/node_modules/meteor/npm-bcrypt/

npm install bcrypt

TheRealmGaming commented 8 years ago

@mlecoq and then did you re-run mup deploy? Mine isn't deploying and I imagine re-running deploy would overwrite your changes.

mlecoq commented 8 years ago

@TheRealmGaming no, i did not re-run mup deploy.

standard-vision commented 8 years ago

Hi @TheRealmGaming @mlecoq , I'm having the same issue. Thanks for your help with this. I was able to use the new bcrypt and re-run mup deploy by "fighting the clock" -- I made my "deployCheckWaitTime" value in mup.json long enough for me to be able to delete the bcrypt that is installed at /opt/app-name/app/programs/server/npm/node_modules/meteor/npm-bcrypt/ upon deployment, and reinstall the newest version (0.8.5). All I'm wondering now is whether I can automate this process or if I should open a new issue to try and get this resolved...

mlecoq commented 8 years ago

@SV-Developer I may try to migrate to the new meteor-up : https://github.com/kadirahq/meteor-up

mlecoq commented 8 years ago

@SV-Developer I don't think it's a meteor-up issue. I have tried a manual build (meteor build ...) and the same issue occurs.

mlecoq commented 8 years ago

\ o / Newer versions of the following indirect dependencies are available:

npm-bcrypt 0.7.8_2 (0.8.5 is available)

mlecoq commented 8 years ago

@SV-Developer @TheRealmGaming This issue will be fixed in Meteor 1.3.2 For the moment you can use 1.3-beta.11 to deploy

meteor update --release METEOR@1.3-beta.11

standard-vision commented 8 years ago

Great news! Thank you for researching this.

lijoantony commented 8 years ago

@mlecoq Looks like the fix is not included in the 1.3.2 or 1.3.2.1 releases.

mlecoq commented 8 years ago

@lijoantony I did not test them directly with meteor up (last time I used meteor build). I will check. This issue is viewed as closed : https://github.com/meteor/meteor/issues/6778

mlecoq commented 8 years ago

@lijoantony you are right I still have the issue with meteor up

lijoantony commented 8 years ago

Not fixed in 1.3.2.2 either :(

liuzhuotao commented 8 years ago

Same issue here. Cannot deploy to a VM hosted by DigitalOcean.

Any help?

lijoantony commented 8 years ago

As mentioned by @mlecoq above, use METEOR@1.3-beta.11 Unfortunately I need 1.3.2 for some mobile fixes. Juggling with git branches now!

vincro commented 8 years ago

I, in the end ditched MUP and rolled my own scripts. Not that hard, just not as quick as writing one line of code. The best thing you can do on DO is to make some snapshots and then all you need to do is deploy them and run deploy/build/npm install a number of time, which can be scripted anyhow.

liuzhuotao commented 8 years ago

In the end, I got no luck from mup.

I turned to mupx, the successor of mup. I update my meteor to 1.3.2.2. Then mupx smoothly deploys my app on a DigitalOcean VM with 3.13 linux kernel.

Best luck for everyone. :)

mbateman commented 8 years ago

Seems like this is affecting quite a few people. Is there any prospect of it getting resolved in the near future? It has been a problem for over a year.

mlecoq commented 8 years ago

@mbateman I also use manual build. I think that we have to wait a release of https://github.com/kadirahq/meteor-up

mbateman commented 8 years ago

@mlecoq thanks for the reply. I assume you mean copy a local build to the target platform and start it there.

mlecoq commented 8 years ago

@mbateman yes

mbateman commented 8 years ago

I just used the METEOR@1.3-beta.11 workaround which works fine too. It seems strange that it this is not in subsequent releases.

mlecoq commented 8 years ago

@mbateman If you have a stacktrace with latest version (1.3.2.4), we can reopen this issue https://github.com/meteor/meteor/issues/6778

mbateman commented 8 years ago

@mlecoq I have left a comment on meteor/meteor#6778.

chuikoffru commented 8 years ago

@zliuInspire Thanks! 1.3.2.2 + mupx - good works! Install to flops.ru ubuntu 14.04 linux 3.16.

mbateman commented 8 years ago

@mlecoq Is the plan to include the fix present in METEOR@1.3-beta.11 in the next release? (e.g. 1.3.2.5)

lijoantony commented 8 years ago

Switched to mupx. it works!

Testato commented 8 years ago

same problem here on Meteor 1.3.3.1 the bcrypt version is 0.8.5, by manually npm update, like @mlecoq suggest, it go to bcrypt 0.8.7 and work. But the porblem is always that after a deploy you must delete and reinstall bcrypt

c9s commented 8 years ago

I forked this repo and started a new project from this basis, the deploy script will fix the bcrypt issue automatically. You can just install the mup from here https://github.com/c9s/meteor-up