Mongodb-memory-server: Cannot download MongoDB binary on different systems.

Created on 2 Jun 2021  路  25Comments  路  Source: nodkz/mongodb-memory-server

Versions

  • NodeJS: 14.16.1
  • mongodb-memory-server-*: ^6.9.6
  • mongodb: "^3.6.7"
  • mongoose: "^5.12.12"
  • system: Windows 10 home, x64 based

package: mongo-memory-server: mongo-memory-server

-->

What is the Problem?

When trying to run my developed tests on other developers systems i get the error: Package does not exist 403 (MongoDB 404). I have tried adding a mongodb bin version as previously suggested in other bug reports.
If i try to enter specific version (whichever one) it tells me that the combination of architecture types isnt available.

Code Example

Do you know why it happenes?

For some reason it DOES work on my system, perfectly fine. I can download the 'latest' binary of MongoDB or any specific version. But when we try it on the other systems it does NOT work. All are windows, and x64 based.

bug

All 25 comments

  • what version of mongodb (the binary) are you trying to use? (default for 6.x is 4.0.14)
  • what is the full error?
  • what version are you using where its working?
  • did you already try an 7.0.0-beta.x version?
  • We have tried multiple ones, mine personally ran on the 'default' pick, but also worked on the other versions suggested in multiple other threads.
  • I cant get the full error screenshot right now (other developer is not online) but it is the same as this one : https://github.com/nodkz/mongodb-memory-server/issues/344
    I couldn't find a example of the architecture bug which comes when we try certain versions, but i'd guess that one is because we try versions that aren't even compatible.
  • No, ill try upgrading myself and see if it continues to work on my machine, and tomorrow i can try to get the others to retry it with 7.0.0
  • I'm currently using "mongodb-memory-server": "^6.9.6" without any extra configuration settings used in either the package.json or a separate file. We HAVE tried the config -> version solution.

I cant get the full error screenshot right now (other developer is not online) but it is the same as this one : #344

sorry, this dosnt say much (because the original didnt include an in-depth error and others had similar but maybe not the same error)

No, ill try upgrading myself and see if it continues to work on my machine, and tomorrow i can try to get the others to retry it with 7.0.0

as a note, here is the migration guide


when doing the full error, please report the full log that is generated with debug enabled (TL;DR: MONGOMS_DEBUG=1) and preferably not an screenshot but an code block

I wonder if this is related to the issue I've been contending with all day. I'm receiving a similar error (will paste below).

It seems like it _might_ have to do with the processor architecture coming out incorrectly. My architecture is x64, but it seems to get to i386 somehow...

Error:

C:\Users\redact>npm i -D mongodb-memory-server

> [email protected] postinstall C:\redact\node_modules\mongodb-memory-server
> node ./postinstall.js

mongodb-memory-server: checking MongoDB binaries cache...
failed to download/install MongoDB binaries. The error: Error: Status Code is 403 (MongoDB's 404)
This means that the requested version-platform combination doesn't exist
  Used Url: "https://fastdl.mongodb.org/win32/mongodb-win32-i386-2008plus-ssl-4.0.14.zip"
Try to use different version 'new MongoMemoryServer({ binary: { version: 'X.Y.Z' } })'
List of available versions can be found here:
  https://www.mongodb.org/dl/linux for Linux
  https://www.mongodb.org/dl/osx for OSX
  https://www.mongodb.org/dl/win32 for Windows
npm WARN saveError ENOENT: no such file or directory, open 'C:\redact\package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open 'C:\redact\package.json'
npm WARN redact No description
npm WARN redact No repository field.
npm WARN redact No README data
npm WARN redact No license field.

+ [email protected]
added 77 packages from 34 contributors and audited 77 packages in 6.713s

11 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Notably, my issue occurs even when installing as the error also seems to be voiced in the postinstall.js

Quick addition here:

I installed with MONGOMS_DEBUG=1 and the only additional information is as follows:

Error: Too small (243 bytes) mongod binary downloaded from https://fastdl.mongodb.org/win32/mongodb-win32-i386-2008plus-ssl-4.0.3.zip

@milespossing what does executing the following code in an standalone nodejs process (like the REPL or an simple script) yield on the erroring machine?

console.log("process", process.arch)
console.log("os", require('os').arch())

@hasezoey perhaps this answers my questions a bit more directly:

// tmp.js
console.log("process", process.arch)
console.log("os", require('os').arch())
//

$ node tmp.js
process ia32
os ia32

That was a good tip. I'm digging in to why js has those values for me

@milespossing i will also later look into if those value are actually correctly mapped, but currently my understanding is that ia32 is correlating to i386 on windows (mongodb only provides i386 on windows, not ia32 (and i686 on linux))

@hasezoey, that sounds reasonable to me for sure. I'm currently reinstalling node to see if there was something involved there which poses an issue.

No matter what node should be receiving x64 or amd64 from my machine, it's hard to imagine that it would get anything else from my system.

Whenever i had the error with architecture it also showed windows 32 for the not working devices, while they are windows 64 based.

image
The error on the not working machine

@PascalVorwerkTopicus so your issue is the same as @milespossing
and the issue being: windows being ia32 (converted to i386), Intels way of saying x86_32, which (by my research an some old knowledge) means that windows or application is running in 32-bit mode, which mongodb does not support anymore (highest version for i386 being 3.2.22

you could also test overwriting the architecture with this option (TL;DR: MONGOMS_ARCH=x64)

Is overwriting it doable through package.json?

@PascalVorwerkTopicus read the linked documentation (from the top), but yes it would be, though it is easier to quickly test with the env variable (especially when being on a 7.0.0 beta)

Ah okay thanks, sorry for the trivial questions, only in 2nd year of college, it's all a bit new . In any case thanks for helping out.

@PascalVorwerkTopicus so your issue is the same as @milespossing
and the issue being: windows being ia32 (converted to i386), Intels way of saying x86_32, which (by my research an some old knowledge) means that windows or application is running in 32-bit mode, which mongodb does not support anymore (highest version for i386 being 3.2.22

you could also test overwriting the architecture with this option (TL;DR: MONGOMS_ARCH=x64)

This solved the issue for 1 developer (of the 2) working in my team, he is able to download a mongoDB bin now! Tomorrow i will test it with the other developer aswell. If you agree, i'd like to keep this open untill then, just incase it might not fix it for them!

If you agree, i'd like to keep this open untill then, just incase it might not fix it for them!

i would actually prefer to find the "root" of this problem

  • is the processor x64 capable? (mostly all modern cpus are that i know of)
  • is windows in x64 mode?
  • is the application (nodejs) installed in x64?

@hasezoey Not sure about all of these, its 11:35 PM so the other dev went too bed. Tomorrow i'll try to find out all of these points tho! Thanks for helping today!

@PascalVorwerkTopicus yes, and just out of curiosity, what windows edition & version are being used? (like: Windows 7 / Windows 10 1804 / Windows Server 2008)

  • Processor AMD FX(tm)-8350 Eight-Core Processor, 4000 Mhz, 4 Core(s), 8 Logical Processor(s)
  • image When looking up system specs.
  • image When running command node -p "process.arch"
  • Windows version : Windows 10 Pro

@PascalVorwerkTopicus no clue, maybe wrong nodejs installed?

@hasezoey the node version gave back ia32, which was the x32 bit version right? So we tried to specifically install a x64 version now. Seeing if that gives better results with the mongodb binary.

So yeah it appears to be a node installation. We installed node by clicking the 64 bit installer on the node website and it made us able to remove the extra "arch": "64" override in the options. So the root problem seems to be a node 32 bit installation?

Still some of my tests failed , which we couldn't figure out why, but that doesn't seem to be a issue with this repository, so i won't bother you with that :)

Just wanted to weigh in that everything began working with a fresh version of node x64. Somehow when I originally downloaded the msi it gave me the i386 flavor, I belive. Clicking the x64 specifically, reinstalling, clearing node_modules and running npm i is all it took for me to be up and running.

so basically the issue for all here was that an wrong "version" of nodejs was installed

closed as fixed

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ecalcutin picture ecalcutin  路  6Comments

wu-json picture wu-json  路  8Comments

yavorski picture yavorski  路  6Comments

elreeda picture elreeda  路  3Comments

hasezoey picture hasezoey  路  7Comments