博客指南
一、博客标题含义和常用的指令
(1).博客标题含义
title: 博客指南 (标题)
tags: (标签)
- null
categories: (分类) - null
mathjax: true (是否启用MathJax公式渲染)
date: 2025-02-27 14:28:53
description: (描述)
(2).常用的指令
hexo cl
hexo g
hexo s
hexo cl
hexo new post 文章名
组合:
(1)本地部署和查看:
hexo cl,hexo g,hexo s
(2)网页部署:
hexo cl;hexo g;hexo d
(3)文章编写中的代码引用
1 | 内容 |
使用方法:
(1) text
内容
(2)
二、vscode 终端无法正常执行脚本命令如何解决
(也是解决在vscode中执行 hexo指令的方法)
我们经常需要在vscode的中安装第三方依赖包,npm是前端目前最大的Node.js模块化管理系统,它能帮助开发者管理和发布Node.js模块。但很多时候我们在vscode的终端中执行npm install命令时经常会报以下错误:
但是在Windows的cmd命令提示符中执行npm命令是正常的。
出现以上问题的原因是windows下powershell工具的默认执行策略导致的,它有6种执行策略,默认策略是Restricted,即“不允许任意脚本的执行”。
在vscode终端运行命令:
get-executionpolicy
如果结果是Restricted,那表示禁止执行脚本
知道了问题的原因,那么我们只需要修改powershell默认的执行策略,让它不限制脚本执行就可以了,方法如下:
点击“开始”菜单按钮,在弹出的菜单栏中找到 Windows PowerShell 工具
选择“以管理员身份运行”,
在命令行窗口中执行以下命令:
set-executionpolicy -executionpolicy unrestricted
此时powshell工具询问是否更改执行策略,输入 a 后按Enter键确认即可
完成以上步骤后,我们再次运行以下命令:get-executionpolicy , 如下图所示:
可以看到执行策略已经发生更改,在vscode中运行npm相关命令,可以正常运行
三、npm下载速度慢 解决方法
国内npm源镜像(npm加速下载)
指定npm镜像
npm 官方原始镜像网址是:https://registry.npmjs.org/
淘宝 NPM 镜像:http://registry.npmmirror.com
阿里云 NPM 镜像:https://npm.aliyun.com
腾讯云 NPM 镜像:https://mirrors.cloud.tencent.com/npm/
华为云 NPM 镜像:https://mirrors.huaweicloud.com/repository/npm/
网易 NPM 镜像:https://mirrors.163.com/npm/
中国科学技术大学开源镜像站:http://mirrors.ustc.edu.cn/
清华大学开源镜像站:https://mirrors.tuna.tsinghua.edu.cn/
腾讯,华为,阿里的镜像站基本上比较全
使用淘宝镜像源加速 NPM
最新的:
npm config set registry https://registry.npmmirror.com
之前的:
npm config set registry https://registry.npm.taobao.org
使用阿里云 镜像源加速 NPM
npm config set registry https://npm.aliyun.com
使用腾讯云镜像源加速 NPM
npm config set registry http://mirrors.cloud.tencent.com/npm/
使用华为云 镜像源加速 NPM
npm config set registry https://mirrors.huaweicloud.com/repository/npm/
返回npm 官方原始镜像
npm config set registry https://registry.npmjs.org/
使用那个镜像,只需要 npm config set registry + 对应的镜像网址就好了
npm config set registry
查看当前的镜像源:npm config get registry
npm config get registry
给文章加密
comments: true
password: 密码
theme: xray
message: 这里记录我的一些事情哦,需要密码才能进入! //描述
abstract: 只有你和我才知道密码! #密码框提示信息
wrong_pass_message: 抱歉, 这个密码看着不太对, 请再试试! #密码错误提示信息