美文网首页
hexo localhost:4000无法访问

hexo localhost:4000无法访问

作者: 大白杏仁 | 来源:发表于2017-11-01 23:01 被阅读0次
  1. 之前重新配置 hexo 遇到过的小坑
    执行
hexo s

执行后命令行提示成功,但是本地依然看不见部署的博客

原因之一很有可能是4000端口被占用。果然,我最近下载了福昕阅读器,在任务管理器中找到 FoxitProtect.exe 进程关闭就行。这是我自己碰到的状况,如果没有这鬼东西,在配置文件里更改端口号(如改为4001, 浏览器进入 localhost:4001),成功的话就是端口被占用了


  1. 顺带手再记下之前没怎么用的 tags

在命令行下每次 new 一片文章出来,会自动添加一些基本信息,比如:

---
title: 'hexo localhost:4000无法访问'
date: 2017-11-01 22:21:11
tags: [hexo, 博客]
---

想增加多个 tags ,用[ ]就行了,多个 tags 之间逗号隔开


  1. hexo 使用 next 主题文章折叠

next 主题默认是不折叠文章的,打开博客页面所有文章详细信息都挂在那,十分难看,直接修改配置文件:

  • 进入 hexo/themes/next 目录
  • 打开 _config.yml 文件,搜索关键字 ‘auto_excerpt’ ,找到如下代码段:
# Automatically Excerpt. Not recommend.
# Please use <!-- more --> in the post to control excerpt accurately.
auto_excerpt:
  enable: false
  length: 150
  • 修改 enable 为 true,保存文本
    另外 length 可以设置:折叠后显示的字数(从文章开头算起 )

  1. Cannot find module 'hexo-util' 错误
    气啊,昨天晚上又出了些状况没能上传,在此记录下...
  • 问题:执行 hexo g 出现错误 Cannot find module 'hexo-util'
  • 解决:在 Hexo 安装目录下右键 Git Bash, 输入 npm install -- save-dev hexo-util 即可
  • 记得在安装目录下载,一开始我直接桌面运行Git Bash,那就废了(参考:https://github.com/iissnan/hexo-theme-next/issues/1480

  1. Cannot set property 'lastIndex' of undefined 错误
    之后再次 hexo g 出现这个错误

相关文章

网友评论

      本文标题:hexo localhost:4000无法访问

      本文链接:https://www.haomeiwen.com/subject/rmjnpxtx.html