hexo
之前配的好好的,运行环境是win10
,一个月不用再打开,本地预览和github pages全是空白打不开,很方。试过重启,更新升级,hexo clean
+ hexo g
重新生成都不行,后来发现端口被福昕占用了改端口也不行。最后终于找到原因了:
用于DNS加速服务的jsdelivr寄了
解决方案
确认4000端口是否占用
powershell查看4000端口占用情况
> netstat -aon|findstr "4000"
TCP 127.0.0.1:4000 0.0.0.0:0 LISTENING 5028
表中的第二列是本地地址,最后一列是程序的PID。从中我们可以看出占用4000端口的程序PID是5028。进一步查看PID为“5028”的是哪个进程或者程序
> tasklist|findstr "5028"
FoxitProtect.exe 5028 Services 0 13,632 K
基本都是福昕啦。所以就换个端口呗,可以命令行直接加参数
> hexo s -p 5000 # 端口改为5000
或者修改_config.yml
文件,添加如下设置
server:
port: 5000
compress: true
header: true
之后就正常hexo s
就可以打开5000端口。
修改默认DNS服务设置
查看_config.next.yml
文件的vendors
设置,把插件从jsdelivr
改成cdnjs
# ---------------------------------------------------------------
# CDN Settings
# See: https://theme-next.js.org/docs/advanced-settings/vendors
# ---------------------------------------------------------------
vendors:
# The CDN provider of NexT internal scripts.
# Available values: local | jsdelivr | unpkg | cdnjs | custom
# Warning: If you are using the latest master branch of NexT, please set `internal: local`
internal: local
# The default CDN provider of third-party plugins.
# Available values: local | jsdelivr | unpkg | cdnjs | custom
# Dependencies for `plugins: local`: https://github.com/next-theme/plugins
plugins: cdnjs #jsdelivr
# Custom CDN URL
# For example:
# custom_cdn_url: https://cdn.jsdelivr.net/npm/${npm_name}@${version}/${minified}
# custom_cdn_url: https://cdnjs.cloudflare.com/ajax/libs/${cdnjs_name}/${version}/${cdnjs_file}
custom_cdn_url:
本地就可以预览了,github pages就重新部署一下吧。
参考链接
https://segmentfault.com/q/1010000008546859
https://www.jianshu.com/p/d3963da3946f
https://blog.csdn.net/qq_35760825/article/details/124862679
https://theme-next.js.org/docs/advanced-settings/vendors.html?highlight=cdn