E: Unable to locate package npm

后端 未结 10 2441
耶瑟儿~
耶瑟儿~ 2020-12-07 18:08

When I try to install npm with sudo apt-get install npm, I got following error:

E: Unable to locate package npm

Why

10条回答
  •  生来不讨喜
    2020-12-07 18:54

    For Debian Stretch, nodejs does not include npm, and to install it as a separate package, you have to enable stretch-backports.

    echo 'deb http://deb.debian.org/debian stretch-backports main' |
    sudo tee /etc/apt/sources.list.d/stretch-backports.list
    apt-get update -y
    apt-get -t stretch-backports install -y npm
    

    In Buster, npm is a regular package, so going forward, this should just work. But some of us will still be stuck partially on Stretch boxes for some time to come.

提交回复
热议问题