鉴于在Hexo玩崩过几次, 也就重装过几次, 这次重装终于决定把所有操作都记录一次了.
Update Hexo at first
Update npm, cnpm
Firstly, let us check the version.
1 | node -v |
2 | v8.9.3 |
3 | npm -v |
4 | 6.4.1 |
5 | cnpm -v |
6 | cnpm@5.2.0 (D:\MUYI Program Files\Nodejs\node_global\node_modules\cnpm\lib\parse_argv.js) |
7 | npm@5.8.0 (D:\MUYI Program Files\Nodejs\node_global\node_modules\cnpm\node_modules\npm\lib\npm.js) |
8 | node@8.9.3 (D:\MUYI Program Files\Nodejs\node.exe) |
9 | npminstall@3.3.0 (D:\MUYI Program Files\Nodejs\node_global\node_modules\cnpm\node_modules\npminstall\lib\index.js) |
10 | prefix=D:\MUYI Program Files\Nodejs\node_global |
11 | win32 x64 10.0.18362 |
12 | registry=https://registry.npm.taobao.org |
update
1 | npm install -g npm |
2 | npm -v |
3 | 6.10.3 |
4 | |
5 | npm install -g cnpm --registry=https://registry.npm.taobao.org |
6 | cnpm -v |
7 | cnpm@6.1.0 (D:\MUYI Program Files\Nodejs\node_global\node_modules\cnpm\lib\parse_argv.js) |
8 | npm@6.10.3 (D:\MUYI Program Files\Nodejs\node_global\node_modules\cnpm\node_modules\_npm@6.10.3@npm\lib\npm.js) |
9 | node@8.9.3 (D:\MUYI Program Files\Nodejs\node.exe) |
10 | npminstall@3.23.0 (D:\MUYI Program Files\Nodejs\node_global\node_modules\cnpm\node_modules\_npminstall@3.23.0@npminstall\lib\index.js) |
11 | prefix=D:\MUYI Program Files\Nodejs\node_global |
12 | win32 x64 10.0.18362 |
13 | registry=https://r.npm.taobao.org |
14 | |
15 | npm cache clean -f |
16 | cnpm install -g n |
17 | |
18 | update all global packages |
19 | cnpm install -g |
Unable to update node
1 | cnpm install -g n |
2 | Downloading n to D:\MUYI Program Files\Nodejs\node_global\node_modules\n_tmp |
3 | Copying D:\MUYI Program Files\Nodejs\node_global\node_modules\n_tmp\_n@5.0.2@n to D:\MUYI Program Files\Nodejs\node_global\node_modules\n |
4 | Installing n's dependencies to D:\MUYI Program Files\Nodejs\node_global\node_modules\n/node_modules |
5 | All packages installed (used 8ms(network 4ms), speed 0B/s, json 0(0B), tarball 0B) |
6 | [n@5.0.2] link D:\MUYI Program Files\Nodejs\node_global\n@ -> D:\MUYI Program Files\Nodejs\node_global\node_modules\n\bin\n |
7 | n stable |
8 | /bin/bash: D:\MUYI Program Files\Nodejs\node_global\node_modules\n\bin\n: 没有那个文件或目录 |
strange, but I decide to leave it alone.= =
Update hexo
As I decide to reinstall Hexo, why note update it to the latest version
1 | npm i hexo-cli -g |
this may take a really long time.
As what I am scared about, it goes wrong
Error Info
1 | npm WARN checkPermissions Missing write access to D:\MUYI Program Files\Nodejs\node_global\node_modules\hexo-cli\node_modules\is-number\node_modules\kind-of |
2 | npm WARN checkPermissions Missing write access to D:\MUYI Program Files\Nodejs\node_global\node_modules\hexo-cli\node_modules\is-number\node_modules |
3 | npm ERR! path D:\MUYI Program Files\Nodejs\node_global\node_modules\hexo-cli\node_modules\is-number\node_modules\kind-of |
4 | npm ERR! code ENOENT |
5 | npm ERR! errno -4058 |
6 | npm ERR! syscall access |
7 | npm ERR! enoent ENOENT: no such file or directory, access 'D:\MUYI Program Files\Nodejs\node_global\node_modules\hexo-cli\node_modules\is-number\node_modules\kind-of' |
8 | npm ERR! enoent This is related to npm not being able to find a file. |
9 | npm ERR! enoent |
10 | |
11 | npm ERR! A complete log of this run can be found in: |
12 | npm ERR! D:\MUYI Program Files\Nodejs\node_cache\_logs\2019-08-12T08_42_25_532Z-debug.log |
</details>
After Googleing some blogs, I decide to reinstall the Hexo totally.
Reinstall Hexo
uninstall
Firstly I need to uninstall hexo.
1 | cnpm uninstall hexo-cli |
Something wrong
1 | npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents): |
2 | npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) |
3 | |
4 | added 55 packages from 56 contributors, removed 157 packages, updated 50 packages and audited 1290 packages in 149.763s |
5 | found 30 vulnerabilities (10 low, 4 moderate, 15 high, 1 critical) |
6 | run `npm audit fix` to fix them, or `npm audit` for details |
</details>
So I
1 | npm audit fix |
However, error again
1 | npm WARN tarball tarball data for swig-templates@^2.0.3 (sha1-a0xDtGIXXfKo2oV6IEM3nsbqb9A=) seems to be corrupted. Trying one more time. |
2 | npm ERR! code EPERM |
3 | npm ERR! syscall unlink |
4 | npm ERR! path D:\PROGRAMME PROJECT\Blog\node_modules\.staging\swig-templates-c7f20818\package.json |
5 | npm ERR! errno -4048 |
6 | npm ERR! Error: EPERM: operation not permitted, unlink 'D:\PROGRAMME PROJECT\Blog\node_modules\.staging\swig-templates-c7f20818\package.json' |
7 | npm ERR! { Error: EPERM: operation not permitted, unlink 'D:\PROGRAMME PROJECT\Blog\node_modules\.staging\swig-templates-c7f20818\package.json' |
8 | npm ERR! cause: |
9 | npm ERR! { Error: EPERM: operation not permitted, unlink 'D:\PROGRAMME PROJECT\Blog\node_modules\.staging\swig-templates-c7f20818\package.json' |
10 | npm ERR! errno: -4048, |
11 | npm ERR! code: 'EPERM', |
12 | npm ERR! syscall: 'unlink', |
13 | npm ERR! path: 'D:\\PROGRAMME PROJECT\\Blog\\node_modules\\.staging\\swig-templates-c7f20818\\package.json' }, |
14 | npm ERR! stack: 'Error: EPERM: operation not permitted, unlink \'D:\\PROGRAMME PROJECT\\Blog\\node_modules\\.staging\\swig-templates-c7f20818\\package.json\'', |
15 | npm ERR! errno: -4048, |
16 | npm ERR! code: 'EPERM', |
17 | npm ERR! syscall: 'unlink', |
18 | npm ERR! path: 'D:\\PROGRAMME PROJECT\\Blog\\node_modules\\.staging\\swig-templates-c7f20818\\package.json', |
19 | npm ERR! parent: 'hexo' } |
20 | npm ERR! |
21 | npm ERR! The operation was rejected by your operating system. |
22 | npm ERR! It's possible that the file was already in use (by a text editor or antivirus), |
23 | npm ERR! or that you lack permissions to access it. |
24 | npm ERR! |
25 | npm ERR! If you believe this might be a permissions issue, please double-check the |
26 | npm ERR! permissions of the file and its containing directories, or try running |
27 | npm ERR! the command again as root/Administrator. |
</details>
1 | npm uninstall hexo-cli -g |
2 | npm uninstall hexo -g |
Install
Once a again, I open the tutorial blog.
this time I open pewershell in admin.
1 | cnpm install hexo-cli -g |
2 | hexo -v |
3 | hexo-cli: 1.1.0 |
4 | os: Windows_NT 10.0.18362 win32 x64 |
5 | http_parser: 2.7.0 |
6 | node: 8.9.3 |
7 | v8: 6.1.534.48 |
8 | uv: 1.15.0 |
9 | zlib: 1.2.11 |
10 | ares: 1.10.1-DEV |
11 | modules: 57 |
12 | nghttp2: 1.25.0 |
13 | openssl: 1.0.2n |
14 | icu: 59.1 |
15 | unicode: 9.0 |
16 | cldr: 31.0.1 |
17 | tz: 2017b |
But I feel like that I just failed to uninstall hexo.
Initialize folder of blog
make a folder for blog files.
1 | mkdir BenatureBlog |
2 | cd BenatureBlog |
initialize hexo (this may take a bit long time )
1 | hexo init |
2 | cnpm install |
3 | |
4 | npm install hexo-deployer-git --save |
1 | hexo g |
2 | hexo s |
3 | hexo d |
Configure
then modify the _config.yml
to configure.
Mathjax
find mathjax config in blog\themes\next\_config.yml
and modify
1 | cnpm uninstall hexo-renderer-marked --save |
2 | npm ERR! code EINVALIDTAGNAME |
3 | npm ERR! Invalid tag name "^undefined": Tags may not have any characters that encodeURIComponent encodes. |
4 | |
5 | npm ERR! A complete log of this run can be found in: |
6 | npm ERR! C:\Users\ben04\AppData\Roaming\npm-cache\_logs\2019-08-13T02_04_50_890Z-debug.log |
7 | |
8 | cnpm i hexo-renderer-pandoc --save |
9 | hexo clean |
As I fialed to uninstall some packages, so I go to /node_modules/
and found the coresspond folder and deleted it directily.
then go to node_modules\kramed\lib\rules\inline.js
1 | //escape: /^\\([\\`*{}\[\]()#$+\-.!_>])/, |
2 | escape: /^\\([`*\[\]()#$+\-.!_>])/, |
3 | //em: /^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/, |
4 | em: /^\*((?:\*\*|[\s\S])+?)\*(?!\*)/, |
img
https://benature.github.io/2018/03/26/Hexo-Configuration/
RSS
1 | cnpm install hexo-generator-feed --save |
Search
1 | cnpm install hexo-generator-searchdb --save |
Reference: