搭建hexo的博客

发布时间:2019-06-05 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了搭建hexo的博客脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
前提:你已经安装了git node
  1. 安装hexo
npm install hexo -g

出现以下的报错信息,随后 是解决方法

npm ERR! tar.unpack untar error /Users/aprildove/.npm/hexo/3.2.2/package.tgz
npm ERR! Darwin 15.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "hexo" "-g"
npm ERR! node v4.4.5
npm ERR! npm  v2.15.5
npm ERR! path /usr/local/lib/node_modules/hexo
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir

npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/hexo'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/hexo']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/usr/local/lib/node_modules/hexo',
npm ERR!   fstream_type: 'Directory',
npm ERR!   fstream_path: '/usr/local/lib/node_modules/hexo',
npm ERR!   fstream_class: 'DirWriter',
npm ERR!   fstream_stack: 
npm ERR!    [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:35:25',
npm ERR!      '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:47:53',
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!     /Users/aprildove/Workspace/github/npm-debug.log

这些信息表明,由于权限不足,无法执行
只需一行sudo chown -R $USER /usr/local 再 重新执行一次npm install hexo -g 即可

Hexo安装后的设置步骤如下
hexo init <folderName> #执行时,此folder中会装入很多hexo配置文件和主题文件,文件目录应为一个子文件
cd <folder> #进入到hexo的文件中
npm install #安装依赖包
hexo generate #生成静态页面至public目录
hexo server #启动服务,默认在http://localhost:4000 
接下来正在选择一套安装主题。。

脚本宝典总结

以上是脚本宝典为你收集整理的搭建hexo的博客全部内容,希望文章能够帮你解决搭建hexo的博客所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: