sudo apt update sudo apt install hugo npm install hexo
运行npm install hexo 时报错:
1 2 3 4 5 6 7 8 9
…… npm ERR! A complete log of this run can be found in: npm ERR! /home/sb/.npm/_logs/2025-12-28T09_01_28_100Z-debug-0.log npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in: npm ERR! /home/sb/.npm/_logs/2025-12-28T09_01_28_100Z-debug-0.log
这是因为权限问题,经过询问gemini找到解决方案:
创建一个新的全局模块存放目录
1
mkdir ~/.npm-global
告诉 npm 使用这个新路径
1
npm config set prefix '~/.npm-global'
将新路径添加到系统的环境变量中 你需要编辑你的 shell 配置文件(如果你用的是默认终端,通常是 ~/.bashrc;如果是 Mac 常用 ~/.zshrc)。
这是因为你使用的是 Hugo Stack 主题,而新版本的 Hugo 内置模板名称发生了变化,或者主题模板引用了一个在当前 Hugo 版本中找不到的内置组件。别担心,这通常是因为 Hugo 在 v0.120.0 之后对内置模板的调用方式做了微调。我们可以通过两种方式快速修复它:方案一:手动创建占位文件(最简单、推荐) 既然它找不到 google_analytics.html,我们就给它创建一个空的文件,让它闭嘴。在你的博客根目录下执行以下命令: