Не удается обновить версию npm EACCES -> обновление npm -g
Я пытаюсь обновить версию Node и npm в последней версии Ubuntu, но я застрял. Я пробовал каждое решение, которое нашел в Интернете - изменение разрешений, полное удаление и переустановка - но все равно ничего не работает. Любой совет, как решить эту проблему?
MYUSER@MYUSER-VirtualBox:~$ npm update -g
npm WARN optional dep failed, continuing readable-stream@1.1.13
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
2 ответа
Как я уже говорил, я попробовал это... Он по-прежнему возвращал одну и ту же версию узла и npm.
Я решил проблему, выполнив следующие шаги для полного удаления:
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
После этого я установил узел из git:
git clone git://github.com/ry/node.git
cd node
./configure
make
sudo make install
И одна последняя перезагрузка системы решила проблему. Спасибо за ответ, хотя.
Иногда, присматриваясь к журналу, вы можете найти удивительные вещи, такие как
npm ERR! Please try running this command again as root/Administrator.
Что приводит к моему предложению, повторите с sudo
sudo npm update -g