You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

安装npm时出现404 Not Found错误,含libssl-dev获取失败该如何解决?

Hey there, let's work through those 404 errors you're facing while installing npm. Both issues trace back to problems with Ubuntu's package repositories, so here's a step-by-step breakdown to fix them:

Fix the Generic 404 Not Found Error

This usually pops up when your system's package index is outdated or the repository server can't serve the requested packages. Try these steps:

  • First, run sudo apt update --fix-missing — this command will repair any broken index files and refresh your repository information.
  • If the error persists, chances are your Ubuntu version is no longer supported (like 16.04 or earlier), and the official security repositories have moved to old-releases. Here's how to switch:
    1. Back up your current sources list first: sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
    2. Edit the sources file with a text editor: sudo nano /etc/apt/sources.list
    3. Replace every instance of security.ubuntu.com/ubuntu and archive.ubuntu.com/ubuntu with old-releases.ubuntu.com/ubuntu
    4. Save and exit (press Ctrl+O, hit Enter, then Ctrl+X), then run sudo apt update again.
Fix the libssl-dev 404 Error

If you're getting a specific 404 for the libssl-dev_1.0.2d-0ubuntu1.5_amd64.deb package, it means this exact version is no longer hosted on the standard security repo. Try this:

  • Download the package directly from the old-releases archive: wget http://old-releases.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.0.2d-0ubuntu1.5_amd64.deb
  • Install the downloaded package: sudo dpkg -i libssl-dev_1.0.2d-0ubuntu1.5_amd64.deb
  • If you hit dependency errors during installation, run sudo apt -f install to automatically fix missing dependencies.
Alternative: Install npm via NVM (Avoid System Repos Altogether)

If you keep running into issues with Ubuntu's package manager, using NVM (Node Version Manager) is a great workaround. It lets you install Node.js and npm independently of your system's packages:

  • Clone the NVM repository to your home directory: git clone https://github.com/nvm-sh/nvm.git ~/.nvm
  • Add the NVM initialization lines to your shell config file (like .bashrc or .zshrc):
    export NVM_DIR="$HOME/.nvm"
    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
    [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
    
  • Reload your shell (or run source ~/.bashrc), then install the latest Node.js (which includes npm): nvm install node

内容的提问来源于stack exchange,提问作者Ayush

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 08:36:39