programing

E: 패키지 npm을 찾을 수 없습니다.

padding 2023. 8. 1. 20:21
반응형

E: 패키지 npm을 찾을 수 없습니다.

npm을 설치하려고 할 때sudo apt-get install npm다음 오류가 발생했습니다.

E: 패키지 npm을 찾을 수 없습니다.

왜 apt는 npm을 찾을 수 없습니까?나는 데비안 9를 사용하고 있고 이미 실행했습니다.

sudo apt-get install nodejs

Node.js 공식 문서에서:

Node.js 패키지는 데비안 시드(불안정), 제시(테스트) 및 휘지(휘지백포트)를 "nodejs"로 공식 레포에 제공됩니다.nodejs 바이너리만 설치합니다.

그래서, 당신이 입력만 한다면.sudo apt-get install nodejs그것은 npm과 같은 다른 goody를 설치하지 않습니다.

다음을 입력해야 합니다.

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

선택 사항: 빌드 도구 설치

npm에서 기본 추가 기능을 컴파일하고 설치하려면 빌드 도구를 설치해야 할 수도 있습니다.

sudo apt-get install -y build-essential

추가 정보:문서 노드 Js

Windows용 Ubuntu에서 이 문제가 발생했습니다. 먼저 실행해 보십시오.

sudo apt-get update
sudo apt-get upgrade

그리고나서

sudo apt-get install npm

저는 데비안 9.2에서 같은 문제에 부딪혔는데, 이것이 제가 극복하기 위해 한 일입니다.

설치

sudo apt install curl
curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
sudo apt-get install -y nodejs
sudo apt-get install -y npm

설치된 버전 확인

node --version
npm --version

원래는 "Debian 9 스트레치에 Node.js LTS를 설치하는 방법" http://linuxbsdos.com/2017/06/26/how-to-install-node-js-lts-on-debian-9-stretch/ 에서 제공되었습니다.

nodejs 저장소를 시스템에 추가하지 않았기 때문에 시스템에서 npm 패키지를 찾을 수 없습니다.

다음 설치 단계를 따르십시오.
시스템 및 파이썬 소프트웨어 속성에 nodejs PPA 저장소 추가

sudo apt-get install curl python-software-properties 
// sudo apt-get install curl software-properties-common

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

그런 다음 npm을 설치합니다.

sudo apt-get install nodejs

npm과 노드가 설치되어 있고 node.js를 사용할 준비가 되었는지 확인합니다.

node -v
npm -v

누군가 nodejs를 설치하지 못한 경우.먼저 npm을 제거하십시오. 이전 설치가 고장났을 수 있습니다.

sudo apt-get remove nodejs
sudo apt-get remove npm

npm 또는 노드 폴더가 아직 있는지 확인하고, 발견되면 삭제합니다.

which node
which npm

데비안 스트레치(데비안 버전 9)의 경우,nodejs포함하지 않음npm별도의 패키지로 설치하려면 사용 가능으로 설정해야 합니다.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

버스터(데비안 10)에서,npm일반적인 패키지이므로 앞으로 이것은 효과가 있을 것입니다.하지만 우리 중 일부는 여전히 앞으로 한동안 스트레치 박스에 부분적으로 갇혀 있을 것입니다.

그러면 오류가 해결됩니다.터미널에서 이 명령을 실행합니다.이러한 명령은 이전 버전을 추가합니다.이러한 명령을 하나씩 실행하기 전에 나중에 업데이트하거나 여기서도 버전을 변경할 수 있습니다.

sudo apt-get install build-essential
wget http://nodejs.org/dist/v0.8.16/node-v0.8.16.tar.gz
tar -xzf node-v0.8.16.tar.gz
cd node-v0.8.16/
./configure
make
sudo make install

내 젠킨스/스캐너 도커에서 sudo는 항상 오류를 생성합니다.

bash: sudo: command not found

업데이트 보고서 목록이 필요했습니다.

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

그리고나서,

 apt-get install nodejs

모든 명령줄 결과는 다음과 같습니다.

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

다음을 사용하여 리포지토리 키를 다운로드합니다.

curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -

그런 다음 리포지토리를 설정합니다.

sudo sh -c "echo deb https://deb.nodesource.com/node_8.x cosmic main \
                 > /etc/apt/sources.list.d/nodesource.list"
sudo apt-get update
sudo apt-get install nodejs

저도 비슷한 문제가 있었고 이것이 저에게 효과가 있었습니다.

NodeSource 패키지 서명 키 추가:

curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
# wget can also be used:
# wget --quiet -O - https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -

원하는 NodeSource 저장소를 추가합니다.

# Replace with the branch of Node.js or io.js you want to install: node_6.x, node_12.x, etc...
VERSION=node_12.x
# The below command will set this correctly, but if lsb_release isn't available, you can set it manually:
# - For Debian distributions: jessie, sid, etc...
# - For Ubuntu distributions: xenial, bionic, etc...
# - For Debian or Ubuntu derived distributions your best option is to use the codename corresponding to the upstream release your distribution is based off. This is an advanced scenario and unsupported if your distribution is not listed as supported per earlier in this README.
DISTRO="$(lsb_release -s -c)"
echo "deb https://deb.nodesource.com/$VERSION $DISTRO main" | sudo tee /etc/apt/sources.list.d/nodesource.list
echo "deb-src https://deb.nodesource.com/$VERSION $DISTRO main" | sudo tee -a /etc/apt/sources.list.d/nodesource.list

하고 설치합니다.Node.js:

sudo apt-get update
sudo apt-get install nodejs

nodejs가 설치되어 있으면 npm도 설치되어 있습니다.Npm은 노드와 함께 제공됩니다.

언급URL : https://stackoverflow.com/questions/47371904/e-unable-to-locate-package-npm

반응형