量子广告

协作发展•畅想双赢

博客Next主题升级失败,处理过程,以后可按此过程。

记录一次hexo博客Next主题,升级失败,重新安装的过程。
注:博客目录为”My_blog”

  • 如果需要升级 node.js 先去 https://nodejs.org/zh-cn/ 下载最新版安装,安装过程自行百度。
  • 备份之前博客文件夹下所有内容(注意如果用git管理过,会有隐藏文件夹 .git )
  • 然后确保文件夹内无其它任何文件,在根目录执行 hexo init ,出现 INFO Start blogging with Hexo! ,为安装完毕,执行 npm install 安装其它依赖包。
  • 执行 hexo -v 查看版本是否正常。
  • 如果使用自动备份功能,则需安装插件 npm install –save shelljs ,并配合 scripts 目录下的 auto_push.js 使用,使用方法下这介绍。
  • 安装全新 Next 主题,执行 git clone https://github.com/theme-next/hexo-theme-next themes/next-7.x ,主题目录在 E:\My_blog\themes\next-7.x
  • 执行 hexo g 和 hexo s 查看结果。

其它主题配置请参照备份文件

自动备份

自动打开编辑器

npm outdated 查看所有包的版本

如果没有老版本的,就没有任何输出
如果有新版本的,会提示你需要更新到的版本

阅读全文 »

本次重新安装博客时,查看帮助文件时发现一个有意思的命令npm outdated

npm outdated 功能

检查过时的软件包

npm outdated 使用

1
npm outdated [[<@scope>/]<pkg> ...]

如果没有老版本的,就没有任何输出,如果有新版本的,会提示你需要更新到的版本。

阅读全文 »

if name == ‘main‘: 的作用和原理

如果代码写得规范一些,通常会写上一句if __name__==’__main__:作为程序的入口,但似乎没有这么一句代码,程序也能正常运行。学到模块这一块的进候,终于弄明白了。
看代码:

1
2
if __name__ == '__main__':
pass

原理分析

一个python文件通常有两种使用方法,第一是作为脚本直接执行,第二是 import 到其他的 python 脚本中被调用(模块重用)执行。因此 if name == ‘main’: 的作用就是控制这两种情况执行代码的过程,在 if name == ‘main’: 下的代码只有在第一种情况下(即文件作为脚本直接执行)才会被执行,而 import 到其他脚本中是不会被执行的。举例说明如下:

阅读全文 »

引子

还在用迅雷?下载速度真慢,IDM挺好,但不支持磁力下载。那么用下Motrix吧。
Motrix 是一款开源的,基于 aria2 的下载工具,支持下载 HTTP、FTP、BT、磁力链、百度网盘等资源,界面清爽,即开即用。

Motrix 官方下载

  • 官方网站:https://motrix.app/
  • 下载地址:https://motrix.app/release/
  • 使用手册:https://www.yuque.com/moapp/help/issues
阅读全文 »

问题描述

使用hexo g部署博客的时候,出现以下错误:

关键字:'lastIndex' of undefined

1
2
3
4
5
6
7
8
9
10
11
12
$ hexo g
INFO Start processing
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
TypeError: Cannot set property 'lastIndex' of undefined
at highlight (E:\My_blog\node_modules\highlight.js\lib\highlight.js:523:35)
at E:\My_blog\node_modules\highlight.js\lib\highlight.js:573:21
at Array.forEach (<anonymous>)
at Object.highlightAuto (E:\My_blog\node_modules\highlight.js\lib\highlight.js:572:62)
at E:\My_blog\node_modules\hexo-util\lib\highlight.js:117:25
at highlight (E:\My_blog\node_modules\hexo-util\lib\highlight.js:120:7)
at highlightUtil (E:\My_blog\node_modules\hexo-util\lib\highlight.js:22:14)
at data.content.data.content.replace (E:\My_blog\node_modules\hexo\lib\plugins\filter\before_post_render\backtick_code_block.js:59:15)
阅读全文 »
0%