zoukankan      html  css  js  c++  java
  • 个人博客搭建过程中异常处理

    个人博客搭建过程中异常处理

    错误分析

    如果你使用Hexo遇到同样的问题,这里有一些常见问题的解决方案。

    YAML Parsing Error

    JS-YAML: incomplete explicit mapping pair; a key node is missed at line 18, column 29:      last_updated: Last updated: %s
    
    1. 参数中包含冒号,请用加引号,如Last updated: %s
    JS-YAML: bad indentation of a mapping entry at line 18, column 31:      last_updated:"Last updated: %s"
    
    1. 字段后面的冒号必须为英文冒号,如:last_updated:
    2. 字段冒号后面必须跟一个空格,如:last_updated: “Last updated: %s”

    EMFILE Error

    Error: EMFILE, too many open files
    

    生成大量的文件时,可能遇到EMFILE错误。

    可以运行以下命令来增加允许同步I / O操作的数量。

    $ ulimit -n 10000
    

    Process Out of Memory

    hexo g时,遇到以下错误:

    FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
    

    如下,更改hexo-cli文件的第一行,来增大nodejs堆内存.该bug已在新版本修复。

    #!/usr/bin/env node --max_old_space_size=8192
    

    Git Deployment Problems

    1. RPC failed
    error: RPC failed; result=22, HTTP code = 403fatal: 'username.github.io' does not appear to be a git repository
    

    确保你有你的电脑上设置git正确或尝试使用HTTPS存储库URL。

    1. Error: ENOENT: no such file or directory

    这个需要有一定的git的知识,因为可能是由于写错了标签,类别,或文件名,导致本地和github冲突了,Git不能自动合并这一变化所以它打破了自动分支。

    解决办法:

    1. 检查文章的标签和类别,确保本地和github上是相同的。
    2. 合并分支(Commit)。
    3. 清除,重构。在站点目录下,命令行(即Git Bash)运行hexo cleanhexo g
    4. 手动将站点目录下的public文件夹复制到您的桌面
    5. 从你的master分支切换到部署在本地分支。
    6. 从桌面复制public文件夹到本地分支。
    7. 合并分支到github(Commit)。
    8. 切回master分支。

    Server Problems

    Error: listen EADDRINUSE
    

    你可能使用相同的端口,同时开启了两个Hexo服务器。如果需要同时开启,可以尝试修改端口设置:

    $ hexo server -p 5000
    

    Plugin Installation Problems

    npm ERR! node-waf configure build
    

    这个错误可能发生在试图安装一个用Cc++或另一个javascript语言编写的插件。确保您已经安装了正确的编译器在您的计算机上。

    Error with DTrace (Mac OS X)

    { [Error: Cannot find module './build/Release/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }{ [Error: Cannot find module './build/default/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }{ [Error: Cannot find module './build/Debug/DTraceProviderBindings'] code: 'MODULE_NOT_FOUND' }
    

    DTrace安装可能有问题,重装:

    $ npm install hexo --no-optional
    

    详见 #1326

    Iterate Data Model on Jade or Swig

    Hexo使用仓库的数据模型。这不是一个数组,所以你可能需要将对象转换为iterable。

    {% for post in site.posts.toArray() %}{% endfor %}
    

    Data Not Updated

    一些数据不能更新或新生成的文件的最后一个版本完全相同。清理缓存,再试一次:

    $ hexo clean
    

    No command is executed

    那个不能使用除helpinitversion以外的命令行(即Git Bash)时, 有可能时站点目录下的package.json文件,缺少hexo ,如下:

    {  "hexo": {    "version": "3.2.2"  }}
    

    Escape Contents

    Hexo使用Nunjucks渲染的页面. { { } }{ % % }将解析和可能会引起麻烦, 如果要在博文中出现,必须使用三引号:

    
    

    Hello {{ sensitive }}

    ​```#### ENOSPC Error (Linux)如果运行命令`$ hexo server` 返回一个错误:
    

    Error: watch ENOSPC …

    可以通过运行`$ npm dedupe`或者以下命令行(即Git Bash):
    

    $ echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

    来增加测试时,你可以看见的文件数量。#### EMPERM Error (Windows Subsystem for Linux)如果在Windows Subsystem for Linux,运行命令`$ hexo server` 返回这个错误:
    
  • 相关阅读:
    ios 中的循环引用问题及解决
    Leetcode-Maximum Depth of Binary Tree
    Leetcode-Min Stack
    Leetcode-Intersection of Two Linked Lists
    Leetcode-Binary Tree Inorder Traversal
    Leetcode-Unique Binary Search Trees II
    Leetcode-Unique Binary Search Trees
    Leetcode-binary Tree Zigzag Level Order Traversal
    Leetcode-Construct Binary Tree from inorder and preorder travesal
    Leetcode-Next Permutation
  • 原文地址:https://www.cnblogs.com/pythonywy/p/11402676.html
Copyright © 2011-2022 走看看