个人搭建hexo并部署到github期间遇到的问题

来源:互联网 发布:js将div内容清空 编辑:程序博客网 时间:2024/06/06 20:58

个人搭建hexo并部署到github期间遇到的问题

categories:
- 搭建环境

tags:
- hexo搭建
- 多说
- Swiftype
- 微搜索

如果有兴趣可以访问我的个人主页:psychola的博客


这里写图片描述
第一次搭建hexo并部署到github,参考了文章“史上最详细“截图”搭建Hexo博客并部署到Github”这上面步骤很全

但是,还是出现了一些问题,只靠这个没法解决:

1. 当你hexo generate时一直报错cannot find module

ERROR Error: Cannot find module 'bluebird'    at Function.Module._resolveFilename (module.js:336:15)    at Function.Module._load (module.js:286:25)    at Module.require (module.js:365:17)    at require (module.js:384:17)    at Object.<anonymous> (D:\Hexo\node_modules\hexo\lib\hexo\index.js         :3:15)    at Module._compile (module.js:434:26)    at Object.Module._extensions..js (module.js:452:10)    at Module.load (module.js:355:32)    at Function.Module._load (module.js:310:12)    at Module.require (module.js:365:17)    at require (module.js:384:17)    ...

解决办法:
安装相应组件

    $ npm install --save bluebird

p.s.后来安装后 继续输入hexo g, hexo d(这些为generate和deploy的缩写,可以使用代替)仍然报错说Cannot find module hexo-generator-category及以下列表中的组件
- hexo-pagination
- ejs
- marked
- stylus
- connect
- lodash
- strip-indent
- nib
- chalk
- hexo-util
- compression

此时只要继续像刚才一样输入下载相应组件的代码即可

2. $ hexo deploy时一直报错ERROR Deployer not found: github

**error: failed to execute prompt script (exit code 1)
fatal: could not read Username for ‘https://github.com‘: No error**

  • 先把_config.yml文件中的type值从github改为git(因为hexo3.0+有一些改变)
  • repository值改为 ssh://git@github.com/lijialalala/lijialalala.github.io.git
  • 再输入命令行 npminstallhexodeployergitsave npm install hexo-server –save

3. 后来我又出现了 Host key verification failed. fatal: Could not read from remote repository.错误

Please make sure you have the correct access rightsand the repository exists.FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.htmlError: Host key verification failed.fatal: Could not read from remote repository.Please make sure you have the correct access rightsand the repository exists.    at ChildProcess.<anonymous> (D:\Hexo\node_modules\hexo-deployer-git\node_modules\hexo-util\lib\spawn.js:42:17)    at emitTwo (events.js:87:13)    at ChildProcess.emit (events.js:172:7)    at maybeClose (internal/child_process.js:817:16)    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)

此时输入最初搭建时的密码 然后 验证的时候 回复yes就可以了

Administrator@USER-20140708CY MINGW64 /d/Hexo$ ssh git@github.comThe authenticity of host 'github.com (192.30.252.129)' can't be established.RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.Are you sure you want to continue connecting (yes/no)?** yes**Warning: Permanently added 'github.com,192.30.252.129' (RSA) to the list of known hosts.PTY allocation request failed on channel 0Hi lijialalala! You've successfully authenticated, but GitHub does not provide shell access.Connection to github.com closed.

4.借助“多说”来建立留言区

  • 首先进入多说首页注册 然后点击“我要安装”(此时会进入 创建站点 的页面,填完后要记住自己的多说域名要填的那部分,即二级域名后面会用到。)
  • 点击确认后,进入页面获取代码,再根据“在hexo中加入多说评论”的步骤即可完成哦~

5.解决Permission denied (publickey). fatal: Could not read from remote repository.”和“Please make sure you have the correct access rights and the repository exists.”的错误

  • 重新下过旧版本的msysgit即可
    详情参见 “解决hexo一个奇怪的错误”

6.“Swiftype”/“微搜索”建立站内搜索功能

  • 帐号注册的步骤及非next主题下的搜索部署完全可以参考文章“利用swiftype为hexo添加站内搜索v2.0”
  • 因为我用的是next主题 所以只需将swiftype的key写入next主题下的_config.yml文件即可,无需把那段生成的script脚本添加到header文件中
swiftype_key: yourswiftypekey 

其中key即为注册时js中的st(‘install’,’yourswiftypekey’)
不清楚的可以参考文章“为hexo-next主题添加tinysou/Swiftype 站内搜索”

7.标签和分类怎么用

参照官网配置好后,只要在每篇文章里的分割线—之前以列表的格式写就好了,如图:
这里写图片描述

8.怎么让百度和google搜到你的文章呢

参照这两篇文章可以解决google搜到文章的问题,但我向百度引擎入口提交了很多次还是没有搜到,也不明缘由,其中第二篇参考文献的作者也遇到了同样的问题,这个就代跟进把。

文章如下:
1. “|Hexo优化|如何向google提交sitemap(详细)”
2. “博客推广——提交搜索引擎”

然后成功后
这里写图片描述

that’s ALL,这仅是个人经验及多多百度问津的结果,如有错误请指出我会更改的。

以下为参考文章,非常感谢
1. “史上最详细“截图”搭建Hexo博客并部署到Github”
2. “在hexo中加入多说评论”
3. “解决hexo一个奇怪的错误”
4. “利用swiftype为hexo添加站内搜索v2.0”
5. “为hexo-next主题添加tinysou/Swiftype 站内搜索”
6. “|Hexo优化|如何向google提交sitemap(详细)”
7. “博客推广——提交搜索引擎”

0 0
原创粉丝点击