Debian Stretch에 npm을 어떻게 설치하나요?

Debian Stretch에 npm을 어떻게 설치하나요?

nodejs내 데비안 확장에 설치되었습니다.

nodejs -v
v4.8.2

같은 방법으로 설치하고 싶습니다 npm.

sudo aptitude install -f npm

  The following NEW packages will be installed:
  libjs-inherits{a} node-abbrev{a} node-ansi{a} node-ansi-align{a} 
  node-ansi-regex{a} node-ansistyles{a} node-aproba{a} node-archy{a} 
  node-balanced-match{a} node-bluebird{a} node-boxen{ab} 
  node-brace-expansion{a} node-builtins{a} node-cacache{ab} 
  node-call-limit{a} node-chownr{a} node-cli-boxes{a} node-clone{a} 
  node-concat-map{a} node-concat-stream{a} node-config-chain{ab} 
  node-copy-concurrently{ab} node-cross-spawn{a} node-cross-spawn-async{a} 
  node-cyclist{a} node-decompress-response{a} node-deep-extend{a} 
  node-defaults{a} node-detect-indent{a} node-detect-newline{a} 
  node-duplexer3{a} node-duplexify{a} node-editor{a} node-encoding{a} 
  node-end-of-stream{a} node-errno{a} node-execa{a} 
  node-flush-write-stream{a} node-from2{a} node-fs-vacuum{a} 
  node-fs-write-stream-atomic{a} node-fs.realpath{a} node-get-stream{a} 
  node-glob{a} node-got{a} node-graceful-fs{a} node-has-symbol-support-x{a} 
  node-has-to-string-tag-x{a} node-has-unicode{a} node-iconv-lite{a} 
  node-iferr{a} node-import-lazy{a} node-imurmurhash{a} node-inflight{a} 
  node-inherits{a} node-ini{a} node-is-npm{a} node-is-object{a} 
  node-is-plain-obj{a} node-is-retry-allowed{a} node-is-stream{a} 
  node-isexe{a} node-isurl{a} node-json-parse-better-errors{a} 
  node-latest-version{a} node-lazy-property{a} node-libnpx{ab} 
  node-lowercase-keys{a} node-lru-cache{a} node-mimic-response{a} 
  node-minimatch{a} node-minimist{a} node-mississippi{a} node-mkdirp{a} 
  node-move-concurrently{ab} node-mute-stream{a} node-nopt{a} 
  node-npm-package-arg{ab} node-npm-run-path{a} node-once{a} node-opener{a} 
  node-p-cancelable{a} node-p-finally{a} node-p-timeout{a} 
  node-package-json{a} node-parallel-transform{a} node-path-is-absolute{a} 
  node-path-is-inside{a} node-prepend-http{a} node-promise-inflight{a} 
  node-promzard{a} node-proto-list{a} node-prr{a} node-pseudomap{a} 
  node-pump{a} node-pumpify{a} node-qw{a} node-rc{a} node-read{a} 
  node-registry-auth-token{a} node-registry-url{a} node-rimraf{a} 
  node-run-queue{a} node-safe-buffer{a} node-semver{a} node-semver-diff{a} 
  node-signal-exit{a} node-sorted-object{a} node-ssri{a} 
  node-stream-each{a} node-stream-iterate{a} node-stream-shift{a} 
  node-string-width{a} node-strip-ansi{a} node-strip-eof{a} 
  node-strip-json-comments{a} node-term-size{a} node-text-table{a} 
  node-through2{a} node-timed-out{ab} node-typedarray{a} node-uid-number{a} 
  node-unique-filename{a} node-unpipe{a} node-url-parse-lax{a} 
  node-url-to-options{a} node-validate-npm-package-name{a} 
  node-wcwidth.js{a} node-which{a} node-widest-line{a} node-wrappy{a} 
  node-write-file-atomic{a} node-xdg-basedir{a} node-xtend{a} node-y18n{a} 
  node-yallist{a} npm{b} 
0 packages upgraded, 137 newly installed, 0 to remove and 30 not upgraded.
Need to get 1,910 kB of archives. After unpacking 12.4 MB will be used.
The following packages have unmet dependencies:
 node-boxen : Depends: node-camelcase (>= 4.0.0) but it is not going to be installed
              Depends: node-chalk (>= 2.0.1) but it is not going to be installed
 node-timed-out : Depends: nodejs (>= 6) but 4.8.2~dfsg-1 is installed
 node-copy-concurrently : Depends: node-mkdirp (>= 0.5.1) but 0.5.0-1 is to be installed
 node-npm-package-arg : Depends: node-hosted-git-info (>= 2.5~) but it is not going to be installed
                        Depends: node-osenv (>= 0.1.4~) but it is not going to be installed
                        Depends: node-semver (>= 5.4.1~) but 5.3.0-1 is to be installed
 node-move-concurrently : Depends: nodejs (>= 8~) but 4.8.2~dfsg-1 is installed
                          Depends: node-mkdirp (>= 0.5.1) but 0.5.0-1 is to be installed
 npm : Depends: nodejs (>= 6.11~) but 4.8.2~dfsg-1 is 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-glob (>= 7.1.2~) but 7.1.1-1 is to be installed
       Depends: node-hosted-git-info (>= 2.6~) but it is not going to be installed
       Depends: node-ini (>= 1.3.5~) but 1.1.0-1 is to be installed
       Depends: node-jsonstream (>= 1.3.2~) but it is not going to be installed
       Depends: node-lockfile (>= 1.0.3~) but it is not going to be installed
       Depends: node-lru-cache (>= 4.1.1~) but 4.0.2-1 is to be installed
       Depends: node-normalize-package-data (>= 2.4~) but it is not going to be installed
       Depends: node-gyp (>= 3.6.2~) but it is not going to be installed
       Depends: node-resolve-from (>= 4.0~) but it is not going to be installed
       Depends: node-npmlog (>= 4.1.2~) but it is not going to be installed
       Depends: node-osenv (>= 0.1.5~) but it is not going to be installed
       Depends: node-read-package-json (>= 2.0.13~) but it is not going to be installed
       Depends: node-request (>= 2.83~) but it is not going to be installed
       Depends: node-retry (>= 0.10.1~) but it is not going 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 it is not going to be installed
       Depends: node-slide (>= 1.1.6~) but it is not going to be installed
       Depends: node-strip-ansi (>= 4.0~) but 3.0.1-1 is to be installed
       Depends: node-tar (>= 4.4~) but it is not going to be installed
       Depends: node-which (>= 1.3~) but 1.2.11-1 is to be installed
 node-libnpx : Depends: node-rimraf (>= 2.6.1) but 2.5.4-2 is to be installed
               Depends: node-which (>= 1.2.14) but 1.2.11-1 is to be installed
               Depends: node-yargs (>= 8.0.2) but it is not going to be installed
 node-config-chain : Depends: node-ini (>= 1.3.4) but 1.1.0-1 is to be installed
 node-cacache : Depends: node-glob (>= 7.1.2) but 7.1.1-1 is to be installed
                Depends: node-lru-cache (>= 4.1.1) but 4.0.2-1 is to be installed
                Depends: node-mkdirp (>= 0.5.1) but 0.5.0-1 is to be installed
                Depends: node-rimraf (>= 2.6.1) but 2.5.4-2 is to be installed
The following actions will resolve these dependencies:

      Keep the following packages at their current version:
1)      node-boxen [Not Installed]                         
2)      node-cacache [Not Installed]                       
3)      node-config-chain [Not Installed]                  
4)      node-copy-concurrently [Not Installed]             
5)      node-got [Not Installed]                           
6)      node-latest-version [Not Installed]                
7)      node-libnpx [Not Installed]                        
8)      node-move-concurrently [Not Installed]             
9)      node-npm-package-arg [Not Installed]               
10)     node-package-json [Not Installed]                  
11)     node-timed-out [Not Installed]                     
12)     npm [Not Installed]                                

내가 y를 선택하면

Accept this solution? [Y/n/q/?] y
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 30 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.

설치되지 않았습니다 npm.

npm
bash: npm: command not found

npmDebian Stretch에 어떻게 설치하나요 ?

답변1

최신 노드 및 npm 버전의 경우 NodeSource 설치 지침을 읽고 따르십시오.

현재 버전(14.x)을 설치하려면 다음을 실행하세요.

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

(Debian Buster에 설치된 노드 v14.5.0/npm 6.14.5)


Debian 백포트 저장소에서 이전 npm(및 nodejs) 버전을 설치하려면 패키지 소스에 백포트 저장소를 추가해야 합니다.

/etc/apt/sources.list기본, contrib 및 무료가 아닌 저장소에 대한 바이너리 패키지를 활성화 하려면 다음 줄을 추가하십시오 (마지막 두 개는 선택 사항임).

deb http://deb.debian.org/debian stretch-backports main contrib non-free

그런 다음 실행

sudo apt update
sudo apt -t stretch-backports install npm

nodejs다음 명령을 사용하여 백포트 저장소에서 v8.11.1로 업데이트 할 수 있습니다 .

sudo apt -t stretch-backports install nodejs

관련 정보