Ryuu 的个人博客

一个计算机初学者

在当前网页按下 F12,转至 Console 输入并回车:

1
2
3
4
// 设置文档body元素内容可编辑性为 true
javascript:document.body.contentEditable='true'
// 打开文档设计模式
document.designMode='on'

便可操作网页中的文本 (如删除,剪切,粘贴,输入操作)

Hexo 小姿势

在本地启动 hexo server

(ctrl + c 停止)

1
hexo s

创建新的博客文章 new blog

1
hexo n "文章名称"

生成文件并部署至仓库 deploy

1
hexo d

部署的信息在 _config.yml 文件最下的 deploy

// _config.yml 示例 (记得冒号后要有空格)

1
2
3
4
5
6
# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
type: git
repo: https://github.com/Ryuu-64/Ryuu-64.github.io
branch: master

hexo 小问题

当node 版本过高时会产生以下 Warning

1
2
3
4
5
6
7
8
9
10
11
12
13
(node:13888) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:13888) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:13888) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
(node:13888) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(node:13888) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:13888) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
(node:10816) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:10816) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
(node:10816) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(node:10816) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:10816) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
(node:10816) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency

官方的 issues https://github.com/stylus/stylus/issues/2534

解决方案

不用改变node的版本

找到项目中的此文件: \node_modules\stylus\lib\nodes\index.js 在最前处添加如下代码即可

1
2
3
exports.lineno = null;
exports.column = null;
exports.filename = null;

后续问题

结果还是有问题

博客部署出错了 详情如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
TypeError [ERR_INVALID_ARG_TYPE]: The "mode" argument must be integer. Received an instance of Object
at copyFile (fs.js:1972:10)
at tryCatcher (F:\Users\Ryuu\Documents\GitWork\MyBlog\HexoBlogLib\node_modules\bluebird\js\release\util.js:16:23)
at ret (eval at makeNodePromisifiedEval (F:\Users\Ryuu\Documents\GitWork\MyBlog\HexoBlogLib\node_modules\bluebird\js\release\promisify.js:184:12), <anonymous>:13:39)
at F:\Users\Ryuu\Documents\GitWork\MyBlog\HexoBlogLib\node_modules\hexo-fs\lib\fs.js:144:39
at tryCatcher (F:\Users\Ryuu\Documents\GitWork\MyBlog\HexoBlogLib\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (F:\Users\Ryuu\Documents\GitWork\MyBlog\HexoBlogLib\node_modules\bluebird\js\release\promise.js:547:31)
at Promise._settlePromise (F:\Users\Ryuu\Documents\GitWork\MyBlog\HexoBlogLib\node_modules\bluebird\js\release\promise.js:604:18)
at Promise._settlePromise0 (F:\Users\Ryuu\Documents\GitWork\MyBlog\HexoBlogLib\node_modules\bluebird\js\release\promise.js:649:10)
at Promise._settlePromises (F:\Users\Ryuu\Documents\GitWork\MyBlog\HexoBlogLib\node_modules\bluebird\js\release\promise.js:729:18)
at Promise._fulfill (F:\Users\Ryuu\Documents\GitWork\MyBlog\HexoBlogLib\node_modules\bluebird\js\release\promise.js:673:18)
at Promise._resolveCallback (F:\Users\Ryuu\Documents\GitWork\MyBlog\HexoBlogLib\node_modules\bluebird\js\release\promise.js:466:57)
at Promise._settlePromiseFromHandler (F:\Users\Ryuu\Documents\GitWork\MyBlog\HexoBlogLib\node_modules\bluebird\js\release\promise.js:559:17)
at Promise._settlePromise (F:\Users\Ryuu\Documents\GitWork\MyBlog\HexoBlogLib\node_modules\bluebird\js\release\promise.js:604:18)
at Promise._settlePromise0 (F:\Users\Ryuu\Documents\GitWork\MyBlog\HexoBlogLib\node_modules\bluebird\js\release\promise.js:649:10)
at Promise._settlePromises (F:\Users\Ryuu\Documents\GitWork\MyBlog\HexoBlogLib\node_modules\bluebird\js\release\promise.js:729:18)
at Promise._fulfill (F:\Users\Ryuu\Documents\GitWork\MyBlog\HexoBlogLib\node_modules\bluebird\js\release\promise.js:673:18)

最终方案

下载一个 nodejs 的 12.x 的版本

再部署就没有任何问题了

还有问题就把高版本的 nodejs 删除

我的博客搭建详细步骤

事前准备

1.安装 Node.js

Node.js® 是一个基于 Chrome V8 引擎 的 JavaScript 运行时环境
建议下载 LTS 版本 (Long Term Support | 长期支持)
官网上下载安装包,然后跟着提示进行操作即可
下载完毕后可以进入控制台
输入 node -v 查看 node 版本
输入 npm -v 查看 npm 版本 (node package manager | node包管理器)

2.安装 git

Git 是一个免费的开源分布式版本控制系统
官网上下载安装包,然后跟着提示进行操作即可,步骤较多,可参考各种安装教程
下载完毕后可以进入控制台,输入 git –version 查看 git 版本,确认安装成功

git config –global user.name “输入你的名称”
git config –global user.email “输入你的邮箱地址”
设置自己的名称和电子邮箱

3.安装淘宝镜像 (可选步骤)

如果使用 npm 安装依赖过慢
进入控制台输入如下命令安装淘宝镜像
npm install -g cnpm –registry=https://registry.npm.taobao.org
使用 cnpm 代替 npm 以提升速度

开始搭建

阅读全文 »
0%