New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hexo server 运行时自动更新出错把页面文章全部清空 #2245

Open
cxgreat2014 opened this Issue Nov 7, 2016 · 12 comments

Comments

4 participants
@cxgreat2014

cxgreat2014 commented Nov 7, 2016

Environment Info

Node version(node -v)

v4.6.0

Your site _config.yml

# Hexo Configuration
## Docs: https://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/

# Site
title: Hexo
subtitle:
description:
author: John Doe
language:
timezone:

# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://yoursite.com
root: /
permalink: :year/:month/:day/:title/
permalink_defaults:

# Directory
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:

# Writing
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link: true # Open external links in new tab
filename_case: 0
render_drafts: false
post_asset_folder: false
relative_link: false
future: true
highlight:
  enable: true
  line_number: true
  auto_detect: false
  tab_replace:

# Category & Tag
default_category: uncategorized
category_map:
tag_map:

# Date / Time format
## Hexo uses Moment.js to parse and display date
## You can customize the date format as defined in
## http://momentjs.com/docs/#/displaying/format/
date_format: YYYY-MM-DD
time_format: HH:mm:ss

# Pagination
## Set per_page to 0 to disable pagination
per_page: 10
pagination_dir: page

# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: landscape

# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
  type:

...

Your theme _config.yml

# Header
menu:
  Home: /
  Archives: /archives
rss: /atom.xml

# Content
excerpt_link: Read More
fancybox: true

# Sidebar
sidebar: right
widgets:
- category
- tag
- tagcloud
- archive
- recent_posts

# display widgets at the bottom of index pages (pagination == 2)
index_widgets:
# - category
# - tagcloud
# - archive

# widget behavior
archive_type: 'monthly'
show_count: false

# Miscellaneous
google_analytics:
favicon: /favicon.png
twitter:
google_plus:
fb_admins:
fb_app_id:

...

Plugin version(npm ls --depth 0)

hexo-site@0.0.0 C:\Users\Administrator\pytwork\blog
├── hexo@3.2.2
├── hexo-generator-archive@0.1.4
├── hexo-generator-category@0.1.3
├── hexo-generator-index@0.2.0
├── hexo-generator-tag@0.2.0
├── hexo-renderer-ejs@0.2.0
├── hexo-renderer-marked@0.2.11
├── hexo-renderer-stylus@0.3.1
└── hexo-server@0.2.0

For BUG

  • 在windows环境下运行hexo server,之后修改了文章再刷新博客页面,hexo不但没有更新,还把页面上原有所有文章都清空了
  • the way to reproduce
  • log with hexo server --debug
    C:\Users\Administrator\pytwork\blog>hexo server --debug
    04:30:55.243 DEBUG Hexo version: 3.2.2
    04:30:55.248 DEBUG Working directory: ~\pytwork\blog
    04:30:55.415 DEBUG Config loaded: ~\pytwork\blog_config.yml
    04:30:55.429 DEBUG Script loaded: themes\landscape\scripts\fancybox.js
    04:30:55.435 DEBUG Plugin loaded: hexo-generator-archive
    04:30:55.439 DEBUG Plugin loaded: hexo-generator-index
    04:30:55.444 DEBUG Plugin loaded: hexo-generator-category
    04:30:55.450 DEBUG Plugin loaded: hexo-generator-tag
    04:30:55.456 DEBUG Plugin loaded: hexo-renderer-ejs
    04:30:55.569 DEBUG Plugin loaded: hexo-renderer-marked
    04:30:55.571 DEBUG Plugin loaded: hexo-renderer-stylus
    04:30:55.746 DEBUG Plugin loaded: hexo-server
    04:30:55.760 DEBUG Loading database.
    04:30:55.792 INFO Start processing
    04:30:55.860 DEBUG Processed: _posts/hello-world.md
    04:30:55.881 DEBUG Theme config loaded.
    04:30:55.881 DEBUG Processed: _config.yml
    04:30:55.900 DEBUG Processed: source/css/style.styl
    04:30:55.901 DEBUG Processed: source/fancybox/blank.gif
    04:30:55.902 DEBUG Processed: source/fancybox/fancybox_loading.gif
    04:30:55.903 DEBUG Processed: source/fancybox/fancybox_loading@2x.gif
    04:30:55.904 DEBUG Processed: source/fancybox/fancybox_overlay.png
    04:30:55.905 DEBUG Processed: source/fancybox/fancybox_sprite.png
    04:30:55.906 DEBUG Processed: source/fancybox/fancybox_sprite@2x.png
    04:30:55.907 DEBUG Processed: source/fancybox/jquery.fancybox.css
    04:30:55.908 DEBUG Processed: source/fancybox/jquery.fancybox.js
    04:30:55.910 DEBUG Processed: source/fancybox/jquery.fancybox.pack.js
    04:30:55.912 DEBUG Processed: source/js/script.js
    04:30:55.930 DEBUG Processed: _posts/苟利国家生死以,岂因祸福避趋之.md
    04:30:55.948 DEBUG Processed: layout/category.ejs
    04:30:55.950 DEBUG Processed: layout/index.ejs
    04:30:55.952 DEBUG Processed: layout/layout.ejs
    04:30:55.952 DEBUG Processed: layout/archive.ejs
    04:30:55.954 DEBUG Processed: layout/page.ejs
    04:30:55.954 DEBUG Processed: layout/tag.ejs
    04:30:55.955 DEBUG Processed: layout/post.ejs
    04:30:55.964 DEBUG Processed: languages/fr.yml
    04:30:55.965 DEBUG Processed: languages/default.yml
    04:30:55.965 DEBUG Processed: languages/nl.yml
    04:30:55.966 DEBUG Processed: languages/no.yml
    04:30:55.966 DEBUG Processed: languages/zh-CN.yml
    04:30:55.967 DEBUG Processed: languages/ru.yml
    04:30:55.967 DEBUG Processed: languages/zh-TW.yml
    04:30:55.968 DEBUG Processed: source/css/fonts/FontAwesome.otf
    04:30:55.969 DEBUG Processed: source/css/fonts/fontawesome-webfont.eot
    04:30:55.970 DEBUG Processed: source/css/fonts/fontawesome-webfont.woff
    04:30:55.971 DEBUG Processed: source/fancybox/helpers/fancybox_buttons.png
    04:30:55.972 DEBUG Processed: source/fancybox/helpers/jquery.fancybox-buttons.cs
    s
    04:30:55.973 DEBUG Processed: source/fancybox/helpers/jquery.fancybox-buttons.js

04:30:55.973 DEBUG Processed: source/fancybox/helpers/jquery.fancybox-media.js
04:30:55.974 DEBUG Processed: source/fancybox/helpers/jquery.fancybox-thumbs.css

04:30:55.975 DEBUG Processed: source/fancybox/helpers/jquery.fancybox-thumbs.js
04:30:56.002 DEBUG Processed: source/css/fonts/fontawesome-webfont.ttf
04:30:56.010 DEBUG Processed: layout/_partial/after-footer.ejs
04:30:56.011 DEBUG Processed: layout/_partial/archive-post.ejs
04:30:56.011 DEBUG Processed: layout/_partial/archive.ejs
04:30:56.012 DEBUG Processed: layout/_partial/article.ejs
04:30:56.012 DEBUG Processed: layout/_partial/footer.ejs
04:30:56.012 DEBUG Processed: layout/_partial/google-analytics.ejs
04:30:56.013 DEBUG Processed: layout/_partial/head.ejs
04:30:56.014 DEBUG Processed: layout/_partial/header.ejs
04:30:56.014 DEBUG Processed: layout/_partial/mobile-nav.ejs
04:30:56.014 DEBUG Processed: layout/_widget/archive.ejs
04:30:56.015 DEBUG Processed: layout/_partial/sidebar.ejs
04:30:56.015 DEBUG Processed: layout/_widget/category.ejs
04:30:56.016 DEBUG Processed: layout/_widget/recent_posts.ejs
04:30:56.016 DEBUG Processed: layout/_widget/tagcloud.ejs
04:30:56.017 DEBUG Processed: layout/_widget/tag.ejs
04:30:56.019 DEBUG Processed: source/css/fonts/fontawesome-webfont.svg
04:30:56.020 DEBUG Processed: source/css/images/banner.jpg
04:30:56.024 DEBUG Processed: layout/_partial/post/date.ejs
04:30:56.024 DEBUG Processed: layout/_partial/post/gallery.ejs
04:30:56.025 DEBUG Processed: layout/_partial/post/category.ejs
04:30:56.025 DEBUG Processed: layout/_partial/post/nav.ejs
04:30:56.026 DEBUG Processed: layout/_partial/post/tag.ejs
04:30:56.026 DEBUG Processed: layout/_partial/post/title.ejs
04:30:56.252 DEBUG Generator: page
04:30:56.252 DEBUG Generator: post
04:30:56.253 DEBUG Generator: archive
04:30:56.253 DEBUG Generator: index
04:30:56.253 DEBUG Generator: category
04:30:56.254 DEBUG Generator: tag
04:30:56.255 DEBUG Generator: asset
04:30:56.264 INFO Hexo is running at http://localhost:4000/. Press Ctrl+C to st
op.
04:30:56.277 DEBUG Database saved
04:31:05.078 DEBUG Rendering post: 2016/11/07/苟利国家生死以,岂因祸福避趋之/ind
ex.html
GET /2016/11/07/%E8%8B%9F%E5%88%A9%E5%9B%BD%E5%AE%B6%E7%94%9F%E6%AD%BB%E4%BB%A5%
EF%BC%8C%E5%B2%82%E5%9B%A0%E7%A5%B8%E7%A6%8F%E9%81%BF%E8%B6%8B%E4%B9%8B/ 200 76.
360 ms - -
GET /css/style.css 200 1169.914 ms - -
GET /fancybox/jquery.fancybox.pack.js 200 2.292 ms - -
GET /fancybox/jquery.fancybox.css 200 6.018 ms - -
GET /js/script.js 200 6.299 ms - -
GET /css/fonts/fontawesome-webfont.woff?v= 200 1.637 ms - -
GET /css/images/banner.jpg 200 1.565 ms - -
GET /css/style.css 200 289.600 ms - -
GET /fancybox/jquery.fancybox.css 200 290.319 ms - -
GET /fancybox/jquery.fancybox.css 200 0.685 ms - -

此时修改文章内容并保存

04:31:14.478 DEBUG Processed: _posts/苟利国家生死以,岂因祸福避趋之.md
04:31:14.612 DEBUG Generator: page
04:31:14.619 DEBUG Generator: post
04:31:14.622 DEBUG Generator: archive
04:31:14.623 DEBUG Generator: index
04:31:14.625 DEBUG Generator: category
04:31:14.628 DEBUG Generator: tag
04:31:14.632 DEBUG Generator: asset
04:31:17.047 DEBUG Rendering post: 2016/11/07/苟利国家生死以,岂因祸福避趋之/ind
ex.html
GET /2016/11/07/%E8%8B%9F%E5%88%A9%E5%9B%BD%E5%AE%B6%E7%94%9F%E6%AD%BB%E4%BB%A5%
EF%BC%8C%E5%B2%82%E5%9B%A0%E7%A5%B8%E7%A6%8F%E9%81%BF%E8%B6%8B%E4%B9%8B/ 200 50.
530 ms - -
GET /fancybox/jquery.fancybox.css 200 288.297 ms - -
GET /css/style.css 200 287.329 ms - -
GET /js/script.js 200 292.834 ms - -
GET /fancybox/jquery.fancybox.pack.js 200 295.697 ms - -
GET /css/fonts/fontawesome-webfont.woff?v= 200 1.001 ms - -
GET /css/images/banner.jpg 200 1.357 ms - -
GET /css/style.css 200 201.348 ms - -
GET /fancybox/jquery.fancybox.css 200 202.414 ms - -
GET /fancybox/jquery.fancybox.css 200 0.621 ms - -

@Neveryu

This comment has been minimized.

Show comment
Hide comment
@Neveryu

Neveryu Nov 7, 2016

@cxgreat2014 你更新了啥嘛,是不是有语法错误?

Neveryu commented Nov 7, 2016

@cxgreat2014 你更新了啥嘛,是不是有语法错误?

@cxgreat2014

This comment has been minimized.

Show comment
Hide comment
@cxgreat2014

cxgreat2014 Nov 7, 2016

啥都没更新,创建博客之后就创建了 苟利国家生死以,岂因祸福避趋之.md 然后修改这个文件,文件内容:原

---
title: 苟利国家生死以,岂因祸福避趋之
---
秋天到了

修改后:

---
title: 苟利国家生死以,岂因祸福避趋之
---
秋天到了XD

然后刷新页面。。文章内容就是空白了

cxgreat2014 commented Nov 7, 2016

啥都没更新,创建博客之后就创建了 苟利国家生死以,岂因祸福避趋之.md 然后修改这个文件,文件内容:原

---
title: 苟利国家生死以,岂因祸福避趋之
---
秋天到了

修改后:

---
title: 苟利国家生死以,岂因祸福避趋之
---
秋天到了XD

然后刷新页面。。文章内容就是空白了

@NoahDragon

This comment has been minimized.

Show comment
Hide comment
@NoahDragon

NoahDragon Nov 7, 2016

Member

能否贴一下Developer Tool里的console输出?

如下图:
image

Member

NoahDragon commented Nov 7, 2016

能否贴一下Developer Tool里的console输出?

如下图:
image

@imkratos

This comment has been minimized.

Show comment
Hide comment
@imkratos

imkratos Nov 8, 2016

建议把博客源文件,搞到github上托管,这样怎么删了都没问题了。

imkratos commented Nov 8, 2016

建议把博客源文件,搞到github上托管,这样怎么删了都没问题了。

@cxgreat2014

This comment has been minimized.

Show comment
Hide comment
@cxgreat2014

cxgreat2014 Nov 12, 2016

没有任何错误输出,那里是空的,@NoahDragon

cxgreat2014 commented Nov 12, 2016

没有任何错误输出,那里是空的,@NoahDragon

@NoahDragon

This comment has been minimized.

Show comment
Hide comment
@NoahDragon

NoahDragon Nov 15, 2016

Member

Elements栏里面也什么都没有显示么?

Member

NoahDragon commented Nov 15, 2016

Elements栏里面也什么都没有显示么?

@cxgreat2014

This comment has been minimized.

Show comment
Hide comment
@cxgreat2014

cxgreat2014 Nov 16, 2016

我把整个环境重装了,现在是win7x64和nodejs7最新版,运行hexo server后更改md文件再刷新页面,被更改的那篇文章内容显示为空,只有退出hexo server再重新运行才能看到更改之后的内容

cxgreat2014 commented Nov 16, 2016

我把整个环境重装了,现在是win7x64和nodejs7最新版,运行hexo server后更改md文件再刷新页面,被更改的那篇文章内容显示为空,只有退出hexo server再重新运行才能看到更改之后的内容

@cxgreat2014

This comment has been minimized.

Show comment
Hide comment
@cxgreat2014

cxgreat2014 Nov 16, 2016

现在是更改了内容的那单篇文章内容不显示

cxgreat2014 commented Nov 16, 2016

现在是更改了内容的那单篇文章内容不显示

@cxgreat2014

This comment has been minimized.

Show comment
Hide comment
@cxgreat2014

cxgreat2014 Nov 19, 2016

发现问题所在,我使用的markdown编辑器是typora,原生支持yaml信息和实时渲染,该编辑器在保存文档时貌似是使用重写还是先清空该文件再写反正就那样,在文件清空的时候hexo就去对文件渲染了,之后typora才把文章内容写进去,于是乎hexo显示出来的就是白板了

cxgreat2014 commented Nov 19, 2016

发现问题所在,我使用的markdown编辑器是typora,原生支持yaml信息和实时渲染,该编辑器在保存文档时貌似是使用重写还是先清空该文件再写反正就那样,在文件清空的时候hexo就去对文件渲染了,之后typora才把文章内容写进去,于是乎hexo显示出来的就是白板了

@cxgreat2014

This comment has been minimized.

Show comment
Hide comment
@cxgreat2014

cxgreat2014 Nov 20, 2016

这个问题。。有办法解决吗?还是我去向typora提交issue?

cxgreat2014 commented Nov 20, 2016

这个问题。。有办法解决吗?还是我去向typora提交issue?

@NoahDragon

This comment has been minimized.

Show comment
Hide comment
@NoahDragon

NoahDragon Nov 20, 2016

Member

@cxgreat2014 我在mac上无法重现,使用的是atom和vim编辑器。

Member

NoahDragon commented Nov 20, 2016

@cxgreat2014 我在mac上无法重现,使用的是atom和vim编辑器。

@cxgreat2014

This comment has been minimized.

Show comment
Hide comment
@cxgreat2014

cxgreat2014 Nov 27, 2016

在一个hexo generate要几分钟以上的博客post目录下新建个test.md,随便写点啥,然后运行hexo server之后在post目录运行以下python代码并查看页面:

open('test.md','wb').write(''.encode())
open('test.md','wb').write('---\r\ntitle: xxx \r\n---\r\n test撒旦飞洒地方sd'.encode())

或者运行这个查看一样效果

from time import sleep
open('test.md','wb').write(''.encode())
sleep(0.01)
open('test.md','wb').write('---\r\ntitle: xxx \r\n---\r\n test撒旦飞洒地方sd'.encode())

极短时间内两次修改第一次是清空文件就会出现这个BUG

cxgreat2014 commented Nov 27, 2016

在一个hexo generate要几分钟以上的博客post目录下新建个test.md,随便写点啥,然后运行hexo server之后在post目录运行以下python代码并查看页面:

open('test.md','wb').write(''.encode())
open('test.md','wb').write('---\r\ntitle: xxx \r\n---\r\n test撒旦飞洒地方sd'.encode())

或者运行这个查看一样效果

from time import sleep
open('test.md','wb').write(''.encode())
sleep(0.01)
open('test.md','wb').write('---\r\ntitle: xxx \r\n---\r\n test撒旦飞洒地方sd'.encode())

极短时间内两次修改第一次是清空文件就会出现这个BUG

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment