搭建私人博客踩过的坑(心酸)

搭建私人博客踩过的坑

最近闲来无事,和小伙伴研究研究搭建私人博客的问题本来,网上关于私人博客的教程有很多,于是照着一步一步下来,于是出事了…真的是“砰砰砰砰砰”,一步一雷,酸爽


事故大概是这样的:

cmd下hexo命令可以使用

Microsoft Windows [版本 10.0.17763.615]
(c) 2018 Microsoft Corporation。保留所有权利。

C:\Users\YBJB>hexo
Usage: hexo <command>

Commands:
  help     Get help on a command.  init     Create a new Hexo folder.  version  Display version information.
Global Options:
  --config  Specify config file instead of using _config.yml  --cwd     Specify the CWD  --debug   Display all verbose messages in the terminal  --draft   Display draft posts  --safe    Disable all plugins and scripts  --silent  Hide output on console
For more help, you can use 'hexo help [command]' for the detailed information
or you can check the docs: http://hexo.io/docs/

C:\Users\YBJB>

但是git Bash下却显示找不到

YBJB@LAPTOP-GC1JGK7U MINGW64 /d/workspace/Blog (master)

$ hexo

bash: hexo: command not found

我检查了一下node和npm都有,但是还是找不到hexo指令



YBJB@LAPTOP-GC1JGK7U MINGW64 /d/workspace/Blog (master)

$ node -v

v10.16.0



YBJB@LAPTOP-GC1JGK7U MINGW64 /d/workspace/Blog (master)

$ npm -v

6.9.0

探索

重装解决一切…然后又…

npm install XXX 没反应

YBJB@LAPTOP-GC1JGK7U MINGW64 /d/workspace/Blog (master)

$ npm install -g hexo-cli

[1]+  Stopped                 npm install -g hexo-cli

      1 [sig] sh 22716! sigpacket::process: Suppressing signal 18 to win32 proce 
ss (pid 396)


试过几次,每次都是没反应,不得不强退

于是猜测是不是网络原因
YBJB@LAPTOP-GC1JGK7U MINGW64 /d/workspace/Blog (master)

$ npm install -g hexo-cli --registry=https://registry.npm.taobao.org

C:\Users\YBJB\AppData\Roaming\npm\hexo -> C:\Users\YBJB\AppData\Roaming\npm\node 
_modules\hexo-cli\bin\hexo

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\hex 
o-cli\node_modules\fsevents):

npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@ 
1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"} 
)

+ hexo-cli@2.0.0

added 187 packages from 433 contributors in 25.236s

这次带上了某宝的镜像,一开始还是没反应,但是最终在25s的时候完成,证明猜中了
装完之后,测试hexo

YBJB@LAPTOP-GC1JGK7U MINGW64 /d/workspace/Blog (master)
$ hexo
Usage: hexo <command>
Commands:
  help     Get help on a command.  init     Create a new Hexo folder.  version   
Display version information.

Global Options:

  --config  Specify config file instead of using _config.yml  --cwd     Specify  
the CWD  --debug   Display all verbose messages in the terminal  --draft   Displ 
ay draft posts  --safe    Disable all plugins and scripts  --silent  Hide output  
on console

For more help, you can use 'hexo help [command]' for the detailed information

or you can check the docs: http://hexo.io/docs/



hexo init 报错

事情大概是这样的…

YBJB@LAPTOP-GC1JGK7U MINGW64 /d/workspace/Blog (master)

$ hexo init

FATAL D:\workspace\Blog not empty, please run `hexo init` on an empty folder and  
then copy your files into it

FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/do 
cs/troubleshooting.html

Error: target not empty

    at Context.initConsole (C:\Users\YBJB\AppData\Roaming\npm\node_modules\hexo- 
cli\lib\console\init.js:23:27)

    at Context.tryCatcher (C:\Users\YBJB\AppData\Roaming\npm\node_modules\hexo-c 
li\node_modules\bluebird\js\release\util.js:16:23)

    at Context.<anonymous> (C:\Users\YBJB\AppData\Roaming\npm\node_modules\hexo- 
cli\node_modules\bluebird\js\release\method.js:15:34)

    at Promise (C:\Users\YBJB\AppData\Roaming\npm\node_modules\hexo-cli\lib\cont 
ext.js:39:9)

    at Promise._execute (C:\Users\YBJB\AppData\Roaming\npm\node_modules\hexo-cli 
\node_modules\bluebird\js\release\debuggability.js:313:9)

    at Promise._resolveFromExecutor (C:\Users\YBJB\AppData\Roaming\npm\node_modu 
les\hexo-cli\node_modules\bluebird\js\release\promise.js:488:18)

    at new Promise (C:\Users\YBJB\AppData\Roaming\npm\node_modules\hexo-cli\node 
_modules\bluebird\js\release\promise.js:79:10)

    at Context.call (C:\Users\YBJB\AppData\Roaming\npm\node_modules\hexo-cli\lib 
\context.js:35:10)

    at findPkg.then.then.then (C:\Users\YBJB\AppData\Roaming\npm\node_modules\he 
xo-cli\lib\hexo.js:67:17)

    at tryCatcher (C:\Users\YBJB\AppData\Roaming\npm\node_modules\hexo-cli\node_ 
modules\bluebird\js\release\util.js:16:23)

    at Promise._settlePromiseFromHandler (C:\Users\YBJB\AppData\Roaming\npm\node 
_modules\hexo-cli\node_modules\bluebird\js\release\promise.js:517:31)

    at Promise._settlePromise (C:\Users\YBJB\AppData\Roaming\npm\node_modules\he 
xo-cli\node_modules\bluebird\js\release\promise.js:574:18)

    at Promise._settlePromise0 (C:\Users\YBJB\AppData\Roaming\npm\node_modules\h 
exo-cli\node_modules\bluebird\js\release\promise.js:619:10)

    at Promise._settlePromises (C:\Users\YBJB\AppData\Roaming\npm\node_modules\h 
exo-cli\node_modules\bluebird\js\release\promise.js:699:18)

    at Promise._fulfill (C:\Users\YBJB\AppData\Roaming\npm\node_modules\hexo-cli 
\node_modules\bluebird\js\release\promise.js:643:18)

    at Promise._resolveCallback (C:\Users\YBJB\AppData\Roaming\npm\node_modules\ 
hexo-cli\node_modules\bluebird\js\release\promise.js:437:57)


看完前两行就知道咋回事。。。原来是我手贱,在git Bash命令的时候顺手用了个git init 指令,结果导致Blog文件夹不为空,也就报了这个错,解决就是清空或者重建一个文件夹。
正确效果:

YBJB@LAPTOP-GC1JGK7U MINGW64 /d/workspace/CBlog

$ hexo init

INFO  Cloning hexo-starter https://github.com/hexojs/hexo-starter.git

Cloning into 'D:\workspace\CBlog'...

remote: Enumerating objects: 4, done.

remote: Counting objects: 100% (4/4), done.

remote: Compressing objects: 100% (4/4), done.

remote: Total 81 (delta 0), reused 1 (delta 0), pack-reused 77

Unpacking objects: 100% (81/81), done.

Submodule 'themes/landscape' 
(https://github.com/hexojs/hexo-theme-landscape.git) registered for path 
'themes/landscape'

Cloning into 'D:/workspace/CBlog/themes/landscape'...

remote: Enumerating objects: 40, done.

remote: Counting objects: 100% (40/40), done.

remote: Compressing objects: 100% (32/32), done.

remote: Total 1018 (delta 16), reused 21 (delta 7), pack-reused 978

Receiving objects: 100% (1018/1018), 3.22 MiB | 54.00 KiB/s, done.

Resolving deltas: 100% (549/549), done.

Submodule path 'themes/landscape': checked out 
'73a23c51f8487cfcd7c6deec96ccc7543960d350'

INFO  Install dependencies

yarn install v1.17.3

info No lockfile found.

[1/4] Resolving packages...

info There appears to be trouble with your network connection. Retrying...

info There appears to be trouble with your network connection. Retrying...

warning hexo > warehouse > cuid > core-js@1.2.7: core-js@<2.6.8 is no longer 
maintained. Please, upgrade to core-js@3 or at least to actual version of 
core-js@2.

info There appears to be trouble with your network connection. Retrying...

info There appears to be trouble with your network connection. Retrying...

[2/4] Fetching packages...

info There appears to be trouble with your network connection. Retrying...

info fsevents@1.2.9: The platform "win32" is incompatible with this module.

info "fsevents@1.2.9" is an optional dependency and failed compatibility check. 
Excluding it from installation.

[3/4] Linking dependencies...

[4/4] Building fresh packages...

success Saved lockfile.

Done in 301.13s.

INFO  Start blogging with Hexo!



error set ting certificate verify locations:

YBJB@LAPTOP-GC1JGK7U MINGW64 /d/workspace/Blog (master)

$ git clone https://github.com/iissnan/hexo-theme-next themes/next

Cloning into 'themes/next'...

fatal: unable to access 'https://github.com/iissnan/hexo-theme-next/': error set 
ting certificate verify locations:

  CAfile: D:/IDEInstall/Git/usr/bin/curl-ca-bundle.crt

  CApath: none


是的,在运行git clone 命令的时候证书位置有错了(我也不知道咋回事,以前是可以用的,大概是屋漏偏逢。。。哎),解决办法就是该对位置就好了

YBJB@LAPTOP-GC1JGK7U MINGW64 /d/workspace/Blog (master)

$ git config --system  http.sslcainfo "D:\IDEInstall\Git\mingw64\ssl\certs\ca-bu 
ndle.crt"

YBJB@LAPTOP-GC1JGK7U MINGW64 /d/workspace/Blog (master)

$ git clone https://github.com/iissnan/hexo-theme-next themes/next               
Cloning into 'themes/next'...

remote: Enumerating objects: 12037, done.

Receivingremote: Total 12037 (delta 0), reused 0 (delta 0), pack-reused 12037

Receiving objects: 100% (12037/12037), 13.05 MiB | 33.00 KiB/s, done.

Resolving deltas: 100% (6962/6962), done.

可以看到成功克隆下来了




fatal: The remote end hung up unexpectedly

今早继续搞结果又悲剧了,这个问题说它挂掉了。
为什么会挂掉,百度一波后,原因无非两点:墙、文件太大

  • 方法一:修改提交缓存大小为500M,或者更大的数字
git config --global http.postBuffer 524288000
  • 方法二:配置git的最低速度和最低速度时间:
git config --global http.lowSpeedLimit 0
git config --global http.lowSpeedTime 999999  单位 秒
--global配置对当前用户生效,如果需要对所有用户生效,则用--system
  • 方法三:换个更好的网络,比如把连的校园网(真的慢)断掉开热点之类的。



总结

想想都。。。。命途多舛,干啥啥出事也是可以的,单是搭框架就用了一个晚上(昨天弄到很晚,生物钟感觉快乱了)加早上一个小时,不过最终还是搭出来了欢迎来到我的博客,虽然这里还啥都没有,我曾经尝试过使用远程服务器当仓库(毕竟便宜),后来不知道啥原因,可能是仓库建的不对,本地git推不过去,有时间还得研究研究。

补充

Hexo博客出现“Cannot GET/xxx”错误

是的,装主题的时候又出毛病了,之前一直好的hexo g 命令竟然在public生成index.html 文件,于是查了一圈,各种方法都试过了,都没用比如:npm audit fix,再比如hexo c ,hexo g再来一遍,又或者npm ls --depth 0看看哪个插件没装之类,都试过了,没用。
一顿饭过后,越想越觉得是命令出问题了,配置是坑定没错的(在手贱运行 hexo c之前是好好的),就试着重装一遍npm install hexo-generator-index,由于万能的墙于是加了某宝镜像 npm install hexo-generator-index --registry=https://registry.npm.taobao.org,装完之后运行一遍hexo c和hexo g 成功。。。。

YBJB@LAPTOP-GC1JGK7U MINGW64 /d/workspace/CBlog
$ npm install hexo-generator-index  --registry=https://registry.npm.taobao.org
npm WARN rollback Rolling back node-pre-gyp@0.12.0 failed (this is probably harmless): EPERM: operation not permitted, lstat 'D:\workspace\CBlog\node_modules\fsevents\node_modules'
npm WARN rollback Rolling back readable-stream@2.3.6 failed (this is probably harmless): EPERM: operation not permitted, lstat 'D:\workspace\CBlog\node_modules\fsevents\node_modules'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ hexo-generator-index@0.2.1
added 1 package from 1 contributor, removed 1 package and audited 13847 packages in 7.778s
found 5 vulnerabilities (4 low, 1 critical)
  run `npm audit fix` to fix them, or `npm audit` for details

YBJB@LAPTOP-GC1JGK7U MINGW64 /d/workspace/CBlog
$ hexo clean
INFO  Deleted database.
INFO  Deleted public folder.

YBJB@LAPTOP-GC1JGK7U MINGW64 /d/workspace/CBlog
$ hexo g
INFO  Start processing
INFO  Files loaded in 5.42 s
INFO  Generated: index.html
INFO  Generated: archives/index.html
INFO  Generated: tags/index.html
INFO  Generated: categories/index.html
INFO  Generated: link/index.html
INFO  Generated: gallery/index.html
INFO  Generated: img/comment_bg.png
INFO  Generated: img/favicon.ico
INFO  Generated: img/alipay.png
INFO  Generated: archives/2019/index.html
INFO  Generated: img/algolia.svg
INFO  Generated: img/wechat.jpg
INFO  Generated: img/cat.jpg
INFO  Generated: archives/2019/08/index.html
INFO  Generated: img/alipay.jpg
INFO  Generated: img/friend_404.gif
INFO  Generated: img/404.jpg
INFO  Generated: css/var.css
INFO  Generated: js/baidupush.js
INFO  Generated: js/runtimeshow.js
INFO  Generated: js/nightshift.js
INFO  Generated: js/activate-power-mode.js
INFO  Generated: js/utils.js
INFO  Generated: css/index.css
INFO  Generated: js/tw_cn.js
INFO  Generated: js/main.js
INFO  Generated: 2019/08/12/hello-world/index.html
INFO  Generated: js/search/algolia.js
INFO  Generated: js/search/local-search.js
INFO  Generated: js/third-party/fireworks.js
INFO  Generated: js/third-party/canvas-ribbon.js
INFO  Generated: js/third-party/anime.min.js
INFO  Generated: js/third-party/piao.js
INFO  Generated: js/third-party/jquery.fancybox.min.js
INFO  Generated: img/avatar.png
INFO  Generated: js/third-party/jquery.min.js
INFO  36 files generated in 1.84 s

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
无法import name 'graph_objects'的错误通常是由于缺少相关的库或模块引起的。根据提供的引用内容,我无法找到与该错误相关的具体信息或背景。然而,如果您遇到了这个错误,一般来说可以考虑以下几种解决方法: 1. 确认您是否正确安装了所需的库和模块。如果缺少相关的库或模块,可以使用pip或conda等包管理工具来安装它们。 2. 检查您的代码中是否存在拼写错误或语法错误。确保正确导入所需的库和模块,并正确使用它们的函数和类。 3. 确认您的环境设置是否正确。有时候,不同的环境设置可能会导致导入错误。请确保您的环境设置与您的代码要求相匹配。 4. 如果您使用的是第三方库或框架,可以查阅相关文档或社区论坛,寻找与该错误相关的解决方案或其他用户遇到类似问题的讨论。 总之,不能import name 'graph_objects'的错误可能有多种原因,需要您仔细检查代码、环境和相关资料,以找到适合您情况的解决方案。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [TensorFlow模型训练中的心酸(问题)汇总](https://blog.csdn.net/qq_62096941/article/details/127399820)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

椰子奶糖

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值