E: Unable to locate package npm

后端 未结 10 2442
耶瑟儿~
耶瑟儿~ 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:45

    in my jenkins/jenkins docker sudo always generates error:

    bash: sudo: command not found
    

    I needed update repo list with:

    curl -sL https://deb.nodesource.com/setup_10.x | apt-get update
    

    then,

     apt-get install nodejs
    

    All the command line results like this:

    root@76e6f92724d1:/# curl -sL https://deb.nodesource.com/setup_10.x | apt-get update
    Ign:1 http://deb.debian.org/debian stretch InRelease
    Get:2 http://security.debian.org/debian-security stretch/updates InRelease [94.3 kB]
    Get:3 http://deb.debian.org/debian stretch-updates InRelease [91.0 kB]
    Get:4 http://deb.debian.org/debian stretch Release [118 kB]
    Get:5 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [520 kB]
    Get:6 http://deb.debian.org/debian stretch-updates/main amd64 Packages [27.9 kB]
    Get:8 http://deb.debian.org/debian stretch Release.gpg [2410 B]
    Get:9 http://deb.debian.org/debian stretch/main amd64 Packages [7083 kB]
    Get:7 https://packagecloud.io/github/git-lfs/debian stretch InRelease [23.2 kB]
    Get:10 https://packagecloud.io/github/git-lfs/debian stretch/main amd64 Packages [4675 B]
    Fetched 7965 kB in 20s (393 kB/s)
    Reading package lists... Done
    root@76e6f92724d1:/#  apt-get install nodejs
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following additional packages will be installed:
      libicu57 libuv1
    The following NEW packages will be installed:
      libicu57 libuv1 nodejs
    0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
    Need to get 11.2 MB of archives.
    After this operation, 45.2 MB of additional disk space will be used.
    Do you want to continue? [Y/n] y
    Get:1 http://deb.debian.org/debian stretch/main amd64 libicu57 amd64 57.1-6+deb9u3 [7705 kB]
    Get:2 http://deb.debian.org/debian stretch/main amd64 libuv1 amd64 1.9.1-3 [84.4 kB]
    Get:3 http://deb.debian.org/debian stretch/main amd64 nodejs amd64 4.8.2~dfsg-1 [3440 kB]
    Fetched 11.2 MB in 26s (418 kB/s)
    debconf: delaying package configuration, since apt-utils is not installed
    Selecting previously unselected package libicu57:amd64.
    (Reading database ... 12488 files and directories currently installed.)
    Preparing to unpack .../libicu57_57.1-6+deb9u3_amd64.deb ...
    Unpacking libicu57:amd64 (57.1-6+deb9u3) ...
    Selecting previously unselected package libuv1:amd64.
    Preparing to unpack .../libuv1_1.9.1-3_amd64.deb ...
    Unpacking libuv1:amd64 (1.9.1-3) ...
    Selecting previously unselected package nodejs.
    Preparing to unpack .../nodejs_4.8.2~dfsg-1_amd64.deb ...
    Unpacking nodejs (4.8.2~dfsg-1) ...
    Setting up libuv1:amd64 (1.9.1-3) ...
    Setting up libicu57:amd64 (57.1-6+deb9u3) ...
    Processing triggers for libc-bin (2.24-11+deb9u4) ...
    Setting up nodejs (4.8.2~dfsg-1) ...
    update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
    

提交回复
热议问题