Erro de instalação no npm

2

quando estou instalando o npm após instalar o nodejs

best@ubuntu:~$ sudo apt-get 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 but it is not going to be installed
       Depends: nodejs-dev
       Depends: node-request but it is not going to be installed
       Depends: node-mkdirp but it is not going to be installed
       Depends: node-minimatch but it is not going to be installed
       Depends: node-semver but it is not going to be installed
       Depends: node-ini but it is not going to be installed
       Depends: node-graceful-fs but it is not going to be installed
       Depends: node-abbrev but it is not going to be installed
       Depends: node-nopt but it is not going to be installed
       Depends: node-fstream but it is not going to be installed
       Depends: node-rimraf but it is not going to be installed
       Depends: node-tar but it is not going to be installed
       Depends: node-which but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
best@ubuntu:~$ npm -v
1.4.28
best@ubuntu:~$ nodejs -v
v0.10.40
best@ubuntu:~$ 

Eu não sei porque o comando abaixo não é instalado corretamente após a instalação do npm e também está me impedindo de manter os pacotes quebrados.

sudo npm install -g less-plugin-clean-css
sudo npm install -g less

e mais uma coisa quando vou aplicar o comando abaixo

sudo apt-cache policy nodejs npm

Isso me dá uma saída abaixo

nodejs:
  Installed: 0.10.40-1nodesource1~precise1
  Candidate: 0.10.40-1nodesource1~precise1
  Version table:
 *** 0.10.40-1nodesource1~precise1 0
        500 https://deb.nodesource.com/node_0.10/ precise/main i386 Packages
        100 /var/lib/dpkg/status
     0.10.37-1chl1~precise1 0
        500 http://ppa.launchpad.net/chris-lea/node.js/ubuntu/ precise/main i386 Packages
     0.6.12~dfsg1-1ubuntu1 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise/universe i386 Packages
npm:
  Installed: (none)
  Candidate: 1.1.4~dfsg-1
  Version table:
     1.1.4~dfsg-1 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise/universe i386 Packages
    
por DaSaDiYa ChaiTAnYa 02.10.2015 / 12:40

1 resposta

2

Com a instalação dos pacotes nodejs de nodesource , o npm já está instalado.

Nos repositórios oficialmente do Ubuntu existem dois pacotes separados para npm e nodejs e npm depende de nodejs , portanto a confusão.

Basta começar

sudo apt-get install -f

para consertar seu sistema, se houver algo para consertar, e ignorar e não instalar o pacote npm .

E porque acabei de ler isso também na sua pergunta

0.10.37-1chl1~precise1 0
   500 http://ppa.launchpad.net/chris-lea/node.js/ubuntu/ precise/main i386 Packages

o mesmo se aplica se você usar o PPA ppa: chris-lea / node.js .

    
por A.B. 05.10.2015 / 11:12