centos6.5-x64 npm自身升级出错,而且npm接着用不了
发布于 8 年前 作者 lzhgostudy 4450 次浏览 来自 问答

npm ERR! tar.unpack untar error /root/.npm/npm/3.9.2/package.tgz npm ERR! Linux 2.6.32-431.20.3.el6.x86_64 npm ERR! argv “/usr/bin/node” “/usr/bin/npm” “-g” “install” "npm" npm ERR! node v4.4.5 npm ERR! npm v2.15.5 npm ERR! path /usr/lib/node_modules/npm/package.json npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall chown

npm ERR! Error: EACCES: permission denied, chown '/usr/lib/node_modules/npm/package.json’ npm ERR! at Error (native) npm ERR! { [Error: EACCES: permission denied, chown ‘/usr/lib/node_modules/npm/package.json’] npm ERR! errno: -13, npm ERR! code: ‘EACCES’, npm ERR! syscall: ‘chown’, npm ERR! path: ‘/usr/lib/node_modules/npm/package.json’, npm ERR! fstream_finish_call: ‘chown’, npm ERR! fstream_type: ‘File’, npm ERR! fstream_path: ‘/usr/lib/node_modules/npm/package.json’, npm ERR! fstream_class: ‘FileWriter’, npm ERR! fstream_stack: npm ERR! [ ‘/usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:306:21’, npm ERR! ‘/usr/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:210:7’, npm ERR! ‘FSReqWrap.oncomplete (fs.js:82:15)’ ] } npm ERR! npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request: npm ERR! /front_end/project/loanOfficerBackstage/npm-debug.log

装了nodejs-v4.4.5后,发现npm的版本有点低,所有想升级一下,但发现报错了,而且npm命令也用不了: -bash: /usr/bin/npm: No such file or directory 小弟linux刚入门,搞了一天,各种百度,google;重装了几次,还是不行。心开始累了,望大神搭救!

6 回复

安装有风险啊,所以升级之前我一般建议先安装个cnpm, 万一不行了,用cnpm安装npm😄

@ncuzp 这也是个办法,我再重装一遍试试

@ncuzp 依然不行,一旦全局安装就报错,去掉-g就ok,看来是涉及到权限问题,但是我已经是root了,郁闷!

感谢大家的回复,不过怎么重装都没用,npm升级依然报错。所以我换了一下思路,找个地方安装npm@3.9.2,然后在/usr/bin或者/usr/local/bin创建一个npm软链接,指向npm@3.9.2。思路来源参考:http://www.lxway.com/9201106.htm

@lzhgostudy 楼主能否再贴下具体教程。。链接失效了。多谢了。

回到顶部