使用GitHub + Hexo搭建个人博客(五)- Ubuntu升级后hexo命令失效

-----------------------------------------

update: 2014-09-25

参考这篇文章:

使用GitHub + Hexo搭建个人博客(八)- Hexo异常:/usr/bin/env: node: 没有那个文件或目录

先试下这个方法,应该可以,不行的话,再重装

-----------------------------------------

悲剧啊,太坑了,上午Ubuntu系统有升级,坑一样的就升级了,结果hexo命令就失效了,nvm,npm什么的都是好用的,就是用hexo命令的时候提示错误

/usr/bin/env: node: 没有那个文件或目录

报错详细信息:

yuguiyang@onepiece:~$ hexo
/usr/bin/env: node: 没有那个文件或目录

试尝试了重新安装hexo

yuguiyang@onepiece:~$ npm install -g hexo
npm http GET https://registry.npmjs.org/hexo
npm http 304 https://registry.npmjs.org/hexo
npm ERR! error rolling back Error: EACCES, unlink '/usr/local/bin/hexo'
npm ERR! error rolling back  hexo@2.8.3 { [Error: EACCES, unlink '/usr/local/bin/hexo'] errno: 3, code: 'EACCES', path: '/usr/local/bin/hexo' }
npm ERR! Error: EACCES, unlink '/usr/local/bin/hexo'
npm ERR!  { [Error: EACCES, unlink '/usr/local/bin/hexo'] errno: 3, code: 'EACCES', path: '/usr/local/bin/hexo' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 3.13.0-36-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "hexo"
npm ERR! cwd /home/yuguiyang
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /usr/local/bin/hexo
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, unlink '/usr/local/bin/hexo'
npm ERR! Error: EACCES, open 'npm-debug.log'
npm ERR!  { [Error: EACCES, open 'npm-debug.log'] errno: 3, code: 'EACCES', path: 'npm-debug.log' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 3.13.0-36-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "hexo"
npm ERR! cwd /home/yuguiyang
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path npm-debug.log
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open 'npm-debug.log'
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/yuguiyang/npm-debug.log
npm ERR! not ok code 0
上面说用root帐号执行命令试试,那我就换root帐号登下试

安装是成功了,可还是不能用,着让我一顿查啊,找也找不到

后来,我想我都卸载了,重新装还不行吗

于是乎,我卸载了Node.js

yuguiyang@onepiece:~$ nvm uninstall 0.10
Uninstalled node v0.10.32
yuguiyang@onepiece:~$ nvm ls
         N/A
yuguiyang@onepiece:~$ nvm --version
0.16.1
yuguiyang@onepiece:~$ nvm install 0.10
--2014-09-24 13:59:22--  http://nodejs.org/dist/v0.10.32/node-v0.10.32-linux-x86.tar.gz
正在解析主机 nodejs.org (nodejs.org)... 165.225.133.150
正在连接 nodejs.org (nodejs.org)|165.225.133.150|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度: 5444701 (5.2M) [application/octet-stream]
正在保存至: “/home/yuguiyang/.nvm/bin/node-v0.10.32-linux-x86/node-v0.10.32-linux-x86.tar.gz”

100%[============================================================================================>] 5,444,701    384KB/s   用时 18s  

2014-09-24 13:59:40 (299 KB/s) - 已保存 “/home/yuguiyang/.nvm/bin/node-v0.10.32-linux-x86/node-v0.10.32-linux-x86.tar.gz” [5444701/5444701])

Now using node v0.10.32
yuguiyang@onepiece:~$ nvm ls
->  v0.10.32
      system

后来发现,就是她的问题。

接下来重装Hexo,顺利完成了,

yuguiyang@onepiece:~$ npm install -g hexo
npm WARN optional dep failed, continuing fsevents@0.2.0
/home/yuguiyang/.nvm/v0.10.32/bin/hexo -> /home/yuguiyang/.nvm/v0.10.32/lib/node_modules/hexo/bin/hexo
hexo@2.8.3 /home/yuguiyang/.nvm/v0.10.32/lib/node_modules/hexo
├── strip-indent@0.1.3
├── hexo-front-matter@0.0.4
├── graceful-fs@3.0.2
├── sprintf-js@0.0.7
├── colors@0.6.2
├── minimist@0.2.0
├── mime@1.2.11
├── async@0.9.0
├── warehouse@0.2.2 (async@0.7.0)
├── chokidar@0.8.2 (recursive-readdir@0.0.2)
├── morgan@1.3.1 (basic-auth@1.0.0, depd@0.4.5, on-finished@2.1.0)
├── connect@3.2.0 (utils-merge@1.0.0, parseurl@1.3.0, finalhandler@0.2.0, debug@2.0.0)
├── highlight.js@8.1.0
├── compression@1.1.0 (on-headers@1.0.0, vary@1.0.0, bytes@1.0.0, debug@2.0.0, compressible@2.0.0, accepts@1.1.0)
├── serve-static@1.6.2 (utils-merge@1.0.0, escape-html@1.0.1, parseurl@1.3.0, send@0.9.2)
├── lodash@2.4.1
├── cheerio@0.17.0 (dom-serializer@0.0.1, entities@1.1.1, CSSselect@0.4.1, htmlparser2@3.7.3)
├── moment@2.8.3
├── swig@1.4.1 (optimist@0.6.1, uglify-js@2.4.15)
└── js-yaml@3.2.2 (esprima@1.0.4, argparse@0.1.15)
yuguiyang@onepiece:~$ hexo --version
hexo: 2.8.3
os: Linux 3.13.0-36-generic linux ia32
http_parser: 1.0
node: 0.10.32
v8: 3.14.5.9
ares: 1.9.0-DEV
uv: 0.10.28
zlib: 1.2.3
modules: 11
openssl: 1.0.1i
yuguiyang@onepiece:~$ 

记录下,下次直接重装Node.js了。

已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 书香水墨 设计师:CSDN官方博客 返回首页