Mongodb-memory-server: Is it possible to support arm64 (Apple Silicon) downloads without additional config

Created on 10 Dec 2020  路  11Comments  路  Source: nodkz/mongodb-memory-server

Versions

  • NodeJS: v15.3.0
  • mongodb-memory-server: 6.9.2
  • mongodb: 4.0.14
  • mongoose: 5.10.19
  • system: MacOS 11.0.1 ( Apple M1 / arm64 )

package: mongo-memory-server

What is your question?

Would it be possible for MongoMemoryServer to handle the Apple M1 / arm64 architecture without additional configuration. It seems likely that anyone using arm64 will require the x64 mongod binary until there is a arm64 one available.

Background

Trying to run tests with MongoMemoryServer on Apple M1 / arm64 resulted in the following error:

unsupported architecture, ia32 and x64 are the only valid options

I was able to resolve the issue using the MONGOMS_ARCH environment variable

env MONGOMS_ARCH=x64 npn run test

Thanks for creating a fantastic library!

question Distribution support released on @beta

Most helpful comment

Hey, just wanted to say thank you.
The workaround with env MONGOMS_ARCH=x64 works on our MacMini M1 CI server as well as on MBP 13 M1.
It downloads x64 mongo and runs it via Rosetta 2. Great fix until SpiderMonkey produces ARM version and Mongo updates it.

All 11 comments

currently we check only for these 2 supported architectures, because mongodb dosnt provide many arm(64) packages (at least when i last viewed)

@maxpeterson my problem doesn't solve with env MONGOMS_ARCH=x64 npn run test?
how do you solve the problem exactly?

@maxpeterson my problem doesn't solve with env MONGOMS_ARCH=x64 npn run test?
how do you solve the problem exactly?

@amirjani What if you try the MONGOMS_DOWNLOAD_URL env vars outlined in https://github.com/nodkz/mongodb-memory-server#configuring-which-mongod-binary-to-use - pointed to an x64 / ios path.

If that fails you could try manually downloading the binary and copying it to the node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.0.14/mongod

@maxpeterson my problem doesn't solve with env MONGOMS_ARCH=x64 npn run test?
how do you solve the problem exactly?

@amirjani What if you try the MONGOMS_DOWNLOAD_URL env vars outlined in https://github.com/nodkz/mongodb-memory-server#configuring-which-mongod-binary-to-use - pointed to an x64 / ios path.

If that fails you could try manually downloading the binary and copying it to the node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.0.14/mongod

Thanks for your help

we could fix this with below too:

"config": {
    "mongodbMemoryServer": {
    "systemBinary": "/opt/homebrew/bin/mongod",
    "arch": "x64",
    "disablePostinstall": "1",
    "version": "4.4.2", // whatever version you want 
    "debug": "0"
   }
}

Hey, just wanted to say thank you.
The workaround with env MONGOMS_ARCH=x64 works on our MacMini M1 CI server as well as on MBP 13 M1.
It downloads x64 mongo and runs it via Rosetta 2. Great fix until SpiderMonkey produces ARM version and Mongo updates it.

Hi
What about arm64 for ubuntu 20.04, it looks like mongodb provide a binary for that: https://docs.mongodb.com/manual/administration/production-notes/#arm64

@JStonevalley thanks, #443
this issue here is about mac arm64, so i created one to track your suggestion

@JStonevalley thanks, #443
this issue here is about mac arm64, so i created one to track your suggestion

Thank you!

this should be automatically translated in 7.0.0-beta.22, could someone test?

this should be automatically translated in 7.0.0-beta.22, could someone test?

I have tested 7.0.0-beta.22 on Apple M1 / arm64 and the correct mongod binary is downloaded during npm install 馃槃

node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.0.20/mongod --version
db version v4.0.20
git version: e2416422da84a0b63cde2397d60b521758b56d1b
allocator: system
modules: none
build environment:
    distarch: x86_64

After some minor compatibility tweaks (from version 6.9.2) my test pass.

thanks for testing @maxpeterson

closing because fixed in 7.0.0-beta.22

Was this page helpful?
0 / 5 - 0 ratings

Related issues

khasburrahman picture khasburrahman  路  3Comments

baptLesta picture baptLesta  路  7Comments

kbychkov picture kbychkov  路  3Comments

wu-json picture wu-json  路  8Comments

yavorski picture yavorski  路  6Comments