Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid ELF header after upgrade to Meteor 2.4 #11682

Open
dnish opened this issue Oct 6, 2021 · 7 comments
Open

Invalid ELF header after upgrade to Meteor 2.4 #11682

dnish opened this issue Oct 6, 2021 · 7 comments

Comments

@dnish
Copy link

dnish commented Oct 6, 2021

After upgrading to Meteor 2.4, I'm getting the following error on my Ubuntu server:

/current/bundle/programs/server/npm/node_modules/meteor/accounts-password/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node: invalid ELF header

The error didn't happen on the previous version. I'm building the app on a MacOS system, so I know that I have to rebuild the packages on the Ubuntu server. Until Meteor 2.3, this command worked:

cd /current/bundle/programs/server && npm install --production && cd npm && npm rebuild --build-from-source

But for Meteor 2.4, this seems not to work anymore.

// Edit:

For the moment, this will fix the issue:

cd /current/bundle/programs/server/npm/node_modules/meteor/accounts-password
npm rebuild --build-from-source
@StorytellerCZ StorytellerCZ added Project:Accounts:Password Severity:has-workaround Project:Apple Issues on the Apple platforms and software (MacOS, iOS, Safari) and removed Project:Apple Issues on the Apple platforms and software (MacOS, iOS, Safari) labels Oct 7, 2021
@StorytellerCZ
Copy link
Collaborator

Curious, why are you going to the bundle and running npm install there? Is meteor build not good enough?

@zodern
Copy link
Member

zodern commented Oct 7, 2021

@StorytellerCZ that step is required to install some npm dependencies used on the server, and to rebuild native dependencies (galaxy, meteor up, and most other Meteor deployment tools do this step for you). Though if it is working correctly you should only need to run npm install since it is supposed to rebuild all native dependencies for you without running any additional commands.

@dnish what is the content of bundle/programs/server/npm-rebuilds.json? Are you running npm with a root user?

@dnish
Copy link
Author

dnish commented Oct 7, 2021

@zodern The npm-rebuilds.json shows the following:

[
  "npm/node_modules/meteor/ecmascript-runtime-client",
  "npm/node_modules/meteor/ecmascript-runtime-server",
  "npm/node_modules/meteor/babel-compiler",
  "npm/node_modules/meteor/url",
  "npm/node_modules/meteor/accounts-password",
  "npm"
]

Yes, on this server, it is running with the root user.

@StorytellerCZ We are using our own deployment bash script, could be possible that the npm install --production step isn't necessary anymore. The rebuild is needed because we are deploying from MacOS to Ubuntu.

@zodern
Copy link
Member

zodern commented Oct 7, 2021

@dnish does it work if you replace all of the npm commands with cd /current/bundle/programs/server && npm install --unsafe-perm?

@dnish
Copy link
Author

dnish commented Oct 12, 2021

@zodern Right, for this project, we are deploying with the root user. The --unsafe-perm fixed the issue.

@Simon900225
Copy link

I have the exact same problem. I'm also building the app on Mac OSX and deploying it to a linux docker container.

I'm guessing that maybe the build process isn't taking the --architecture os.linux.x86_64 build flag into account when building the meteor packages?

The --unsafe-perm fixed the issue for me too.

@zodern
Copy link
Member

zodern commented Oct 15, 2021

I'm not sure how much the --architecture flag still affects. Since Meteor 1.4.1, most native dependencies have to be rebuilt while deploying. What changed recently is with #11467 every Meteor app now has a native dependency so if the deployment process doesn't rebuild them properly it is now very noticeable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants