NPM: Debian 9.13 Stretch에 대한 충족되지 않은 종속성

NPM: Debian 9.13 Stretch에 대한 충족되지 않은 종속성

Debian 9.13 Stretch를 실행하는 Google Cloud Platform Debian 인스턴스에 NPM을 설치하려고 합니다. 그러나 사용하려고 하면 $ sudo apt install npm다음 메시지가 나타납니다.

Reading package lists... Done                                                                                                                                                        
Building dependency tree                                                                                                                                                             
Reading state information... Done                                                                                                                                                    
Some packages could not be installed. This may mean that you have                                                                                                                    
requested an impossible situation or if you are using the unstable                                                                                                                   
distribution that some required packages have not yet been created                                                                                                                   
or been moved out of Incoming.                                                                                                                                                       
The following information may help to resolve the situation:                                                                                                                         
                                                                                                                                                                                     
The following packages have unmet dependencies:                                                                                                                                      
 npm : Depends: nodejs (>= 6.11~) but 4.8.2~dfsg-1 is to be installed                                                                                                                
       Depends: node-abbrev (>= 1.1.1~) but 1.0.9-1 is to be installed                                                                                                               
       Depends: node-ansi-regex (>= 3.0~) but 2.0.0-1 is to be installed                                                                                                             
       Depends: node-cacache (>= 10.0.4~) but it is not going to be installed                                                                                                        
       Depends: node-config-chain (>= 1.1.11~) but it is not going to be installed                                                                                                   
       Depends: node-glob (>= 7.1.2~) but 7.1.1-1 is to be installed                                                                                                                 
       Depends: node-hosted-git-info (>= 2.6~) but 2.1.5-1 is to be installed                                                                                                        
       Depends: node-ini (>= 1.3.5~) but 1.1.0-1+deb9u1 is to be installed                                                                                                           
       Depends: node-npm-package-arg but it is not going to be installed                                                                                                             
       Depends: node-jsonstream (>= 1.3.2~) but 1.0.3-4 is to be installed                                                                                                           
       Depends: node-libnpx (>= 10.0.1~) but it is not going to be installed                                                                                                         
       Depends: node-lockfile (>= 1.0.3~) but 0.4.1-1 is to be installed                                                                                                             
       Depends: node-lru-cache (>= 4.1.1~) but 4.0.2-1 is to be installed                                                                                                            
       Depends: node-move-concurrently (>= 1.0.1~) but it is not going to be installed                                                                                               
       Depends: node-normalize-package-data (>= 2.4~) but 2.3.5-2 is to be installed                                                                                                 
       Depends: node-gyp (>= 3.6.2~) but 3.4.0-1 is to be installed                                                                                                                  
       Depends: node-resolve-from (>= 4.0~) but 2.0.0-1 is to be installed                                                                                                           
       Depends: node-npmlog (>= 4.1.2~) but 0.0.4-1 is to be installed                                                                                                               
       Depends: node-osenv (>= 0.1.5~) but 0.1.0-1 is to be installed                                                                                                                
       Depends: node-read-package-json (>= 2.0.13~) but 1.2.4-1 is to be installed                                                                                                   
       Depends: node-request (>= 2.83~) but 2.26.1-1 is to be installed                                                                                                              
       Depends: node-retry (>= 0.10.1~) but 0.6.0-1 is to be installed                                                                                                               
       Depends: node-rimraf (>= 2.6.2~) but 2.5.4-2 is to be installed                                                                                                               
       Depends: node-semver (>= 5.5~) but 5.3.0-1 is to be installed                                                                                                                 
       Depends: node-sha (>= 2.0.1~) but 1.2.3-1 is to be installed                                                                                                                  
       Depends: node-slide (>= 1.1.6~) but 1.1.4-1 is to be installed                                                                                                                
       Depends: node-strip-ansi (>= 4.0~) but 3.0.1-1 is to be installed                                                                                                             
       Depends: node-tar (>= 4.4~) but 2.2.1-1 is to be installed                                                                                                                    
       Depends: node-boxen (>= 1.2.1~) but it is not going to be installed                                                                                                           
       Depends: node-latest-version (>= 3.0~) but it is not going to be installed                                                                                                    
       Depends: node-which (>= 1.3~) but 1.2.11-1 is to be installed                                                                                                                 
E: Unable to correct problems, you have held broken packages.

문제를 찾기 위해 기본 소스 목록을 사용하고 표준 명령을 여러 번 $sudo apt install -f npm실행해 보았습니다. sudo apt update어떤 아이디어가 있나요? 이 문제에 대한 버그 보고서도 발견되지 않았습니다.

편집 : 출력sudo apt-cache policy npm

\npm:                                                                                                                                                                                
  Installed: (none)                                                                                                                                                                  
  Candidate: 5.8.0+ds6-2~bpo9+1                                                                                                                                                      
  Version table:                                                                                                                                                                     
     5.8.0+ds6-2~bpo9+1 100                                                                                                                                                          
        100 http://deb.debian.org/debian stretch-backports/main amd64 Packages 

답변1

npm다소 특이하게도 기본 Debian 9 저장소가 아닌 Stretch 백포트에서만 사용할 수 있으며 백포트의 추가 패키지가 필요합니다. 후자는 기본 설치 후보가 아니기 때문에 apt이를 고려하도록 알려야 합니다 .

sudo apt install -t stretch-backports npm

답변2

노드 사용 가능로서snap:

sudo apt install snapd 
sudo snap refresh node --channel=15
sudo snap install node --classic --channel=15

별도의 저장소 사용도 있습니다.설치 스크립트:

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

관련 정보