10

当数据全部消失,部署hexo全过程与踩坑记录

 3 years ago
source link: https://felixxiong.github.io/2021/04/08/%E5%BD%93%E6%95%B0%E6%8D%AE%E5%85%A8%E9%83%A8%E6%B6%88%E5%A4%B1%EF%BC%8C%E9%83%A8%E7%BD%B2hexo%E5%85%A8%E8%BF%87%E7%A8%8B%E4%B8%8E%E8%B8%A9%E5%9D%91%E8%AE%B0%E5%BD%95/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

当数据全部消失,部署hexo全过程与踩坑记录

发表于 2021-04-08

| 分类于 博客探索

Hexo

迁移

| 0

| 阅读次数:

| 3

字数统计: 478

|

阅读时长 ≈ 2

2021年,我电脑更换了主板,数据全部消失。

于是我开始了重新部署Hexo的征程。

因为时间原因,后续会补上我之前关于电脑修复的文章,首先发表于少数派

安装首先根据我之前的迁移目录下的文章,之后根据skycrown的知乎回答一步一步走。

关于我的其他Hexo的问题与优化记录,可配合查看:LeanCloud国内版迁移至国际版

本地预览出现错误

Version 9 of Highlight.js has reached EOL and is no longer supported.
Please upgrade or ask whatever dependency you are using to upgrade.
https://github.com/highlightjs/highlight.js/issues/2877
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
Nunjucks Error:  [Line 70, Column 6] expected name as lookup value, got .
    =====               Context Dump               =====
    === (line number probably different from source) ===
  65 | <pre class="highlight"><code class="">
  66 | {{
  67 |    paginator({
  68 |    prev_text: '<i class="fa fa-angle-left" aria-label="'+__('accessibility.prev_page')+'"></i>',
  69 |    next_text: '<i class="fa fa-angle-right" aria-label="'+__('accessibility.next_page')+'"></i>',
  70 |    ...
  71 |  })
  72 | 
73 |

网站总访问量修正

74 |

更新了不蒜子的域名,官方解释在这里

75 |

修改busuanzi-counter.swig

===== Context Dump Ends ===== at formatNunjucksError (/Users/yourname/FelixXiongHexo/node_modules/hexo/lib/extend/tag.js:102:13) at /Users/yourname/FelixXiongHexo/node_modules/hexo/lib/extend/tag.js:124:34 at tryCatcher (/Users/yourname/FelixXiongHexo/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/Users/yourname/FelixXiongHexo/node_modules/bluebird/js/release/promise.js:547:31) at Promise._settlePromise (/Users/yourname/FelixXiongHexo/node_modules/bluebird/js/release/promise.js:604:18) at Promise._settlePromise0 (/Users/yourname/FelixXiongHexo/node_modules/bluebird/js/release/promise.js:649:10) at Promise._settlePromises (/Users/yourname/FelixXiongHexo/node_modules/bluebird/js/release/promise.js:725:18) at _drainQueueStep (/Users/yourname/FelixXiongHexo/node_modules/bluebird/js/release/async.js:93:12) at _drainQueue (/Users/yourname/FelixXiongHexo/node_modules/bluebird/js/release/async.js:86:9) at Async._drainQueues (/Users/yourname/FelixXiongHexo/node_modules/bluebird/js/release/async.js:102:5) at Immediate.Async.drainQueues [as _onImmediate] (/Users/yourname/FelixXiongHexo/node_modules/bluebird/js/release/async.js:15:14) at processImmediate (internal/timers.js:439:21) ```

mpn报错

```bash npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3. ```

升级core.js

```bash sudo npm install --save core-js@^3 ```

**检查npm更新**

```bash npm-check ```

升级旧版本(根据知乎的迁移回答,我安装的hexo居然是3.9版本)

```bash npm install --save [email protected]

npm install --save [email protected]

npm install --save [email protected] npm install --save [email protected]

npm install --save [email protected]

npm install --save [email protected] npm install --save [email protected]

npm install --save [email protected] ```

### 升级后

 本地预览出现:

```json

{% extends '_layout.swig' %} {% import '_macro/post.swig' as post_template %} {% import '_macro/sidebar.swig' as sidebar_template %} {% block title %}{{ config.title }}{% if theme.index_with_subtitle and config.subtitle %} - {{config.subtitle }}{% endif %}{% endblock %} {% block page_class %} {% if is_home() %}page-home{% endif -%} {% endblock %} {% block content %} {% for post in page.posts %} {% if post.visible !== 'hide' %} {{ post_template.render(post, true) }} {% endif %} {% endfor %} {% include '_partials/pagination.swig' %} {% endblock %} {% block sidebar %} {{ sidebar_template.render(false) }} {% endblock %}

npm i hexo-renderer-swig

hexo c清理缓存,hexo g & s 即可

页脚出现“下一页按钮变成代码”的问题后,修改以下代码后仍直接出现代码:

prev_text: '<i class="fa fa-angle-left" aria-label="'+__('accessibility.prev_page')+'"></i>',
next_text: '<i class="fa fa-angle-right" aria-label="'+__('accessibility.next_page')+'"></i>',
mid_size: 1, 
escape: false #增加此行

hexo和themes Next版本升级

How to update core-js to core-js@3 dependency?

wechat
产品北里,讲述产品和人性、涉及设计、技术和运营的公众号。
你们的赞赏是我更新的动力~

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK