Não é possível atualizar a versão npm EACCES - npm update -g

0

Estou tentando atualizar minha versão do Node e npm no Ubuntu mais recente, mas estou preso. Eu tentei todas as soluções que encontrei na Internet - alterando permissões, concluir a desinstalação e reinstalar - mas ainda nada funciona. Algum conselho sobre como resolver esse problema?

    MYUSER@MYUSER-VirtualBox:~$ npm update -g
    npm WARN optional dep failed, continuing [email protected]
npm ERR! Error: EACCES, mkdir '/home/MYUSER/.node/lib/node_modules/npm/node_modules/init-            package-json/node_modules/semver'
npm ERR! { [Error: EACCES, mkdir '/home/MYUSER/.node/lib/node_modules/npm/node_modules/init-package-json/node_modules/semver']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/home/MYUSER/.node/lib/node_modules/npm/node_modules/init-package-json/node_modules/semver',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/home/MYUSER/.node/lib/node_modules/npm/node_modules/init-package-json/node_modules/semver',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack: 
npm ERR! [ '/usr/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23',
npm ERR! '/usr/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53',
npm ERR! 'Object.oncomplete (fs.js:108:15)' ] }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 3.16.0-33-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "update" "-g"
npm ERR! cwd /home/MYUSER
npm ERR! node -v v0.10.38
npm ERR! npm -v 1.4.28
npm ERR! path /home/MYUSER/.node/lib/node_modules/npm/node_modules/init-package-json/node_modules/semver
npm ERR! fstream_path /home/MYUSER/.node/lib/node_modules/npm/node_modules/init-package-json/node_modules/semver
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/home/MYUSER/.node/lib/node_modules/npm/node_modules/init-package-json/node_modules/semver'
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53
npm ERR! fstream_stack Object.oncomplete (fs.js:108:15)
npm ERR! error rolling back Error: EACCES, unlink '/home/MYUSER/.node/lib/node_modules/npm/node_modules/dezalgo/node_modules/asap'
npm ERR! error rolling back { [Error: EACCES, unlink '/home/MYUSER/.node/lib/node_modules/npm/node_modules/dezalgo/node_modules/asap']
npm ERR! error rolling back errno: 3,
npm ERR! error rolling back code: 'EACCES',
npm ERR! error rolling back path: '/home/MYUSER/.node/lib/node_modules/npm/node_modules/dezalgo/node_modules/asap' }
npm ERR! Error: EACCES, mkdir '/home/MYUSER/.node/lib/node_modules/npm/node_modules/node-gyp/node_modules/tar'
npm ERR! { [Error: EACCES, mkdir '/home/MYUSER/.node/lib/node_modules/npm/node_modules/node-gyp/node_modules/tar']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/home/MYUSER/.node/lib/node_modules/npm/node_modules/node-gyp/node_modules/tar',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/home/MYUSER/.node/lib/node_modules/npm/node_modules/node-gyp/node_modules/tar',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack: 
npm ERR! [ '/usr/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23',
npm ERR! '/usr/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53',
npm ERR! 'Object.oncomplete (fs.js:108:15)' ] }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 3.16.0-33-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "update" "-g"
npm ERR! cwd /home/MYUSER
npm ERR! node -v v0.10.38
npm ERR! npm -v 1.4.28
npm ERR! path /home/MYUSER/.node/lib/node_modules/npm/node_modules/node-gyp/node_modules/tar
npm ERR! fstream_path /home/MYUSER/.node/lib/node_modules/npm/node_modules/node-gyp/node_modules/tar
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/home/MYUSER/.node/lib/node_modules/npm/node_modules/node-gyp/node_modules/tar'
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53
npm ERR! fstream_stack Object.oncomplete (fs.js:108:15)
npm ERR! Error: EACCES, mkdir '/home/MYUSER/.node/lib/node_modules/npm/node_modules/node-gyp/node_modules/request'
npm ERR! { [Error: EACCES, mkdir '/home/MYUSER/.node/lib/node_modules/npm/node_modules/node-gyp/node_modules/request']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/home/MYUSER/.node/lib/node_modules/npm/node_modules/node-gyp/node_modules/request',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/home/MYUSER/.node/lib/node_modules/npm/node_modules/node-gyp/node_modules/request',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack: 
npm ERR! [ '/usr/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23',
npm ERR! '/usr/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53',
npm ERR! 'Object.oncomplete (fs.js:108:15)' ] }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 3.16.0-33-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "update" "-g"
npm ERR! cwd /home/MYUSER
npm ERR! node -v v0.10.38
npm ERR! npm -v 1.4.28
npm ERR! path /home/MYUSER/.node/lib/node_modules/npm/node_modules/node-gyp/node_modules/request
npm ERR! fstream_path /home/MYUSER/.node/lib/node_modules/npm/node_modules/node-gyp/node_modules/request
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/home/MYUSER/.node/lib/node_modules/npm/node_modules/node-gyp/node_modules/request'
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53
npm ERR! fstream_stack Object.oncomplete (fs.js:108:15)
npm ERR! error rolling back Error: EACCES, unlink '/home/MYUSER/.node/lib/node_modules/npm/node_modules/tar'
npm ERR! error rolling back { [Error: EACCES, unlink '/home/MYUSER/.node/lib/node_modules/npm/node_modules/tar']
npm ERR! error rolling back errno: 3,
npm ERR! error rolling back code: 'EACCES',
npm ERR! error rolling back path: '/home/MYUSER/.node/lib/node_modules/npm/node_modules/tar' }
npm ERR! error rolling back Error: EACCES, unlink '/home/MYUSER/.node/lib/node_modules/npm/node_modules/columnify/node_modules/strip-ansi/node_modules/ansi-regex'
npm ERR! error rolling back { [Error: EACCES, unlink '/home/MYUSER/.node/lib/node_modules/npm/node_modules/columnify/node_modules/strip-ansi/node_modules/ansi-regex']
npm ERR! error rolling back errno: 3,
npm ERR! error rolling back code: 'EACCES',
npm ERR! error rolling back path: '/home/MYUSER/.node/lib/node_modules/npm/node_modules/columnify/node_modules/strip-ansi/node_modules/ansi-regex' }
npm ERR! Error: EACCES, mkdir '/home/MYUSER/.node/lib/node_modules/npm/node_modules/normalize-package-data/node_modules'
npm ERR! { [Error: EACCES, mkdir '/home/MYUSER/.node/lib/node_modules/npm/node_modules/normalize-package-data/node_modules']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/home/MYUSER/.node/lib/node_modules/npm/node_modules/normalize-package-data/node_modules',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/home/MYUSER/.node/lib/node_modules/npm/node_modules/normalize-package-data/node_modules/semver',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack: 
npm ERR! [ '/usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:171:23',
npm ERR! '/usr/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53',
npm ERR! 'Object.oncomplete (fs.js:108:15)' ] }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 3.16.0-33-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "update" "-g"
npm ERR! cwd /home/MYUSER
npm ERR! node -v v0.10.38
npm ERR! npm -v 1.4.28
npm ERR! path /home/MYUSER/.node/lib/node_modules/npm/node_modules/normalize-package-data/node_modules
npm ERR! fstream_path /home/MYUSER/.node/lib/node_modules/npm/node_modules/normalize-package-data/node_modules/semver
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/home/MYUSER/.node/lib/node_modules/npm/node_modules/normalize-package-data/node_modules'
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:171:23
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53
npm ERR! fstream_stack Object.oncomplete (fs.js:108:15)
npm ERR! Error: EACCES, mkdir '/home/MYUSER/.node/lib/node_modules/npm/node_modules/npm-registry-client/node_modules/request'
npm ERR! { [Error: EACCES, mkdir '/home/MYUSER/.node/lib/node_modules/npm/node_modules/npm-registry-client/node_modules/request']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/home/MYUSER/.node/lib/node_modules/npm/node_modules/npm-registry-client/node_modules/request',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/home/MYUSER/.node/lib/node_modules/npm/node_modules/npm-registry-client/node_modules/request',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack: 
npm ERR! [ '/usr/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23',
npm ERR! '/usr/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53',
npm ERR! 'Object.oncomplete (fs.js:108:15)' ] }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 3.16.0-33-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "update" "-g"
npm ERR! cwd /home/MYUSER
npm ERR! node -v v0.10.38
npm ERR! npm -v 1.4.28
npm ERR! path /home/MYUSER/.node/lib/node_modules/npm/node_modules/npm-registry-client/node_modules/request
npm ERR! fstream_path /home/MYUSER/.node/lib/node_modules/npm/node_modules/npm-registry-client/node_modules/request
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/home/MYUSER/.node/lib/node_modules/npm/node_modules/npm-registry-client/node_modules/request'
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53
npm ERR! fstream_stack Object.oncomplete (fs.js:108:15)
npm ERR! error rolling back Error: EACCES, unlink '/home/MYUSER/.node/lib/node_modules/npm/node_modules/request'
npm ERR! error rolling back { [Error: EACCES, unlink '/home/MYUSER/.node/lib/node_modules/npm/node_modules/request']
npm ERR! error rolling back errno: 3,
npm ERR! error rolling back code: 'EACCES',
npm ERR! error rolling back path: '/home/MYUSER/.node/lib/node_modules/npm/node_modules/request' }
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR! /home/MYUSER/npm-debug.log
npm ERR! not ok code 0
    
por tslid 02.04.2015 / 08:26

2 respostas

1

Como afirmei, tentei isso ... Ele ainda estava retornando a mesma versão do nó e do npm.

Resolvi o problema seguindo novamente estas etapas para remoção completa:

go to /usr/local/lib and delete any node and node_modules
go to /usr/local/include and delete any node and node_modules directory
if you installed with brew install node, then run brew uninstall node in your terminal
check your Home directory for any local or lib or include folders, and delete any node or node_modules from there
go to /usr/local/bin and delete any node executable
You may need to do the additional instructions as well:

sudo rm /usr/local/bin/npm
sudo rm /usr/local/share/man/man1/node.1
sudo rm /usr/local/lib/dtrace/node.d
sudo rm -rf ~/.npm
sudo rm -rf ~/.node-gyp
sudo rm /opt/local/bin/node
sudo rm /opt/local/include/node
sudo rm -rf /opt/local/lib/node_modules

Depois disso eu instalei o nó do git:

git clone git://github.com/ry/node.git
cd node
./configure
make
sudo make install

E uma reinicialização final do sistema resolveu o problema. Obrigado pela resposta embora.

    
por tslid 02.04.2015 / 15:53
0

Às vezes, olhando mais de perto para o log, você pode encontrar coisas incríveis, como

npm ERR! Please try running this command again as root/Administrator.

O que leva à minha sugestão, tente novamente com o sudo

sudo npm update -g
    
por s1mmel 02.04.2015 / 12:26