question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Global install fails on Amazon Linux 2

See original GitHub issue

Versions

  • NodeJS: 14.17.4
  • mongodb-memory-server-*: 7.3.4
  • system: Amazon Linux 2
  • package: mongo-memory-server-global

What is the Problem?

Installation of the mongodb dist fails with

Mongodb-Memory-Server* checking MongoDB binaries
Mongodb-Memory-Server* failed to find an binary:
 Status Code is 403 (MongoDB's 404)
This means that the requested version-platform combination doesn't exist
  Used Url: "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel-4.0.25.tgz"

When looking up the URL on https://www.mongodb.org/dl/linux I think it should be linux/mongodb-linux-x86_64-amazon2-4.0.25.tgz. Maybe linux/mongodb-linux-x86_64-rhel70-4.0.25.tgz would also work. Note that rhel seems to no longer exist, but rhel70 does. I guess we could open another issue for that.

I’ve tried setting the download URL via export MONGOMS_DOWNLOAD_URL=https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-amazon2-v3.6-latest.tgz. This makes the download succeed, but the package is placed with a weird name and subsequent commands fail:

Mongodb-Memory-Server* checking MongoDB binaries
Mongodb-Memory-Server* found binary: "/root/.cache/mongodb-binaries/mongod-x64-amzn"-4.0.25"
npm WARN saveError ENOENT: no such file or directory, open '/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/package.json'

Specifying the download url and version leads to a similar result:

export MONGOMS_DOWNLOAD_URL=https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-amazon2-v3.6-latest.tgz
export MONGOMS_VERSION=v3.6-latest
Mongodb-Memory-Server* checking MongoDB binaries
Mongodb-Memory-Server* found binary: "/root/.cache/mongodb-binaries/mongod-x64-amzn"-v3.6-latest"
npm WARN saveError ENOENT: no such file or directory, open '/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/package.json'

This is how the ~/.cache/mongodb-binaries/ looks after running the above:

-rwxr-xr-x 1 root root 60297256 Aug  5 20:34 mongod-x64-amzn"-4.0.25
-rwxr-xr-x 1 root root 60297256 Aug  5 20:36 mongod-x64-amzn"-v3.6-latest

I’ve also tried setting MONGOMS_ARCH=linux-x86_64-amazon2. This does not seem to change anything.

Code Example

Start a container with Amazon Linux 2, for example:

docker run -it amazoncorretto:8 /bin/bash

Then from inside the container

yum install -y gcc-c++ make 
curl -sL https://rpm.nodesource.com/setup_14.x | bash - 
yum install -y nodejs
npm install mongodb-memory-server-global@7.3.4

Do you know why it happenes?

no

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:17

github_iconTop GitHub Comments

1reaction
hasezoeycommented, Aug 9, 2021

Download now works, but the extraction somehow fails. Any ideas?

what exactly do you mean? guessing from the log and your ls output, i see nothing wrong (the only problems / error i see in the log is from npm, not related to MMS)

PS: if you mean the size of the binary, no this is not wrong, i downloaded the archive and looked at the file, it is ~61-~63MB (depending on how its shown / counted)

PPS: i would not recommend to have your project in the root of your container (i would recommend to at least put it in a dedicated directory)

0reactions
restfulheadcommented, Aug 11, 2021

You’re right: The binary looks good and is working. Not sure what I had in mind yesterday. So all good then, thanks! 👍

PPS: Right, I’m just using root in my test container. It’s not the setup I have in the real project.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Install Software From the Extras Library on an Amazon Linux 2 ...
To install a software package from the Extras Library, first confirm that the amazon-linux-extras repository is installed on your instance.
Read more >
Install node in Amazon Linux 2 - Stack Overflow
Step 2:– Install Node.js on Amazon Linux $ sudo yum install -y nodejs. Step 3 – Check Version $ node -v $ npm...
Read more >
Can't install sharp on Amazon Linux AMI · Issue #879 - GitHub
It looks like the underlying error message is somehow being suppressed. I'll try running the latest Amazon AMI image with Docker to see...
Read more >
NodeJS not installed successfully in AWS EC2 inside User-data
I've tried to install NodeJS in EC2instance - linux as follow inside ... yum install git -y git config --global credential.helper '!aws codecommit ......
Read more >
Deploy Node app on AWS EC2 Amazon Linux 2 - YouTube
Deploy Node app on AWS EC2 Amazon Linux 2 by installing node js and setting the app up as a systemd serviceCode ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found