Skip to content

Unable to install npm/node on Ubuntu 24.04 LTS instance

0

I'm working on a class assignment and my setup script suddenly started failing today. Looking into the logs, I can see that sudo apt install npm -y --fix-missing is failing with the following error.

==> amazon-ebs.webapp_ami: E: Failed to fetch http://us-east-1.ec2.archive.ubuntu.com/ubuntu/pool/universe/n/node-aproba/node-aproba_2.0.0-3_all.deb  404  Not Found [IP: 52.91.65.63 80]
==> amazon-ebs.webapp_ami: E: Sub-process /usr/bin/dpkg returned an error code (1)
==> amazon-ebs.webapp_ami: Provisioning step had errors: Running the cleanup provisioner, if present...
==> amazon-ebs.webapp_ami: Terminating the source AWS instance...

This looks like an issue with the AWS apt repo, could someone please help me confirm if that is so, and if yes, how do I report it/fix it.

For reference, this is the code being run

sudo apt update -y 
sudo apt upgrade -y
sudo apt autoremove -y
sudo apt install git -y 
sudo apt install unzip -y 
sudo apt install npm -y --fix-missing

asked 2 years ago1K views

3 Answers
0

Hello,
I’ve executed your code on an EC2 instance running Ubuntu 24.04 LTS.
The script is working correctly on my side, so the issue is not related to your code itself.

The insteresting thing is : Failed to fetch http://us-east-1.ec2.archive.ubuntu.com/ubuntu/pool/universe/n/node-aproba/node-aproba_2.0.0-3_all.deb 404 Not Found [IP: 52.91.65.63 80]
This 404 error indicates that the .deb file doesn’t exist at this location, which seems incorrect. When I copy and paste the URL into a browser, I am able to download the .deb file correctly. Maybe caching problem

Try to execute sudo apt clean and retry your command lines. If it's still not working, do you have repository mirroring enabled? Are you behind a proxy? Is it working on other instance? To troubleshoot this issue, try downloading the .deb file manually. One way to do this is to execute: sudo wget http://us-east-1.ec2.archive.ubuntu.com/ubuntu/pool/universe/n/node-aproba/node-aproba_2.0.0-3_all.deb on the instance with the problem.

It seems to be more related to a cache/network issue.

answered 2 years ago

0

The error has occurred for me a few times. It usually happens because Ubuntu repository is being updated, and files are not in sync.

Do sudo apt update and try sudo apt install npm -y again. Usually that will work

AWS
EXPERT

answered 2 years ago

-2

The error you're encountering doesn't appear to be an issue with the AWS apt repository specifically, but rather a problem with the Ubuntu package repository. The error message indicates that the system is unable to fetch a specific package (node-aproba) from the Ubuntu universe repository.

This could be due to a temporary issue with the repository mirror you're using, or the package might have been moved or removed. Here are a few steps you can try to resolve this:

  1. Update your package lists:

    sudo apt update
    
  2. If that doesn't work, try changing your mirror. You can do this by editing the /etc/apt/sources.list file and changing the mirror URL.

  3. If the issue persists, you might want to consider installing Node.js and npm using the NodeSource repository instead. This often provides more up-to-date versions and can be more reliable. Here's how you can do that:

    curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
    sudo apt-get install -y nodejs
    

    This will install both Node.js and npm.

  4. If you're still having trouble, you might want to check if there are any known issues with the Ubuntu 24.04 repositories, as this is a very recent release and might still have some teething problems.

Remember to always be cautious when adding new repositories or making changes to your system configuration, especially when working on a class assignment. If the problem continues, it might be worth reaching out to your instructor or the course's technical support for guidance specific to your assignment requirements.
Sources
Troubleshooting Patch Manager - AWS Systems Manager
Step 2: Set up the Amazon DCV Session Manager broker - Amazon DCV Session Manager

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.