2017-12-04 3 views
0

이 오류가 발생했습니다.npm을 설치할 때이 오류가 발생했습니다

npm : Depends: node-gyp (>= 0.10.9) but it is not going to be installed 
E: Unable to correct problems, you have held broken packages. 

나는 많은 출처를 시도했다. 그러나 오류를 해결할 수 없습니다. 이 오류로, 나는 node-gyp을 설치하려고했습니다. 그러나 그 당시에는 다른 의존성을 보여주고 있습니다. 한 번에 의존성을 설치할 수있는 방법이 있습니까?

+0

설치에 실패한 패키지는 무엇입니까? 실행중인 NodeJS 및 NPM의 버전은 무엇입니까? –

+0

난 그냥 "sudo apt install npm"이 코드를 실행하십시오. – Ranjit

+0

'npm --version'과'node --version'을 실행하십시오. –

답변

0

이전 버전의 노드와 npm을 제거하고 다음 단계를 사용하여 노드 버전 관리자를 사용하여 새 버전을 설치 한 후 패키지를 설치하십시오.

//Remove node 
sudo apt-get purge --auto-remove nodejs npm 

//Remove any leftover files that gives version issues 
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp /opt/local/bin/node opt/local/include/node /opt/local/lib/node_modules 

//Install nvm, this will install npm 5.4 
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash 

//To uninstall a node version 
//nvm uninstall <version> 

nvm install <version you want> 

nvm use <version you installed> 

//check with 
node -v 
npm -v 
관련 문제