Debug in blog
大约 3 分钟
😩Problem
记录在建站期间所遇到的各种各样莫名其妙的问题
报错1
Error: useRouteLocale() is called without provider.error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
解决方法:
yarn add punycode
再build一下,就成功了。
报错2
2023/12/08 13:38:01 \[emerg\] 243047#0: bind() to 0.0.0.0:80 failed (98: Address already in use) 2023/12/08 13:38:01 \[emerg\] 243047#0: still could not bind()
解决方法:
卸载apache2
//1. 删除apache
sudo apt-get --purge remove apache2
sudo apt-get --purge remove apache2.2-common
//2.找到没有删除掉的配置文件,一并删除
sudo find /etc -name "*apache*" |xargs rm -rf
sudo rm -rf /var/www
sudo rm -rf /etc/libapache2-mod-jk
//3.删除关联,这样就可以再次用apt-get install apache2 重装了
#dpkg -l |grep apache2|awk '{print $2}'|xargs dpkg -P//注意:这一步可能会报错,但也没关系
在本地build的时候遇到了一个报错:
本地直接yarn docs:build
会报错:
Error: ENOTDIR: not a directory, scandir '/www/wwwroot/blog.lprincess.top/vuepress/src/.vuepress/dist/.user.ini'
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
这里显示ENOTDIR错误表明你的系统尝试对一个预期中应该是目录的路径执行扫描操作,但这个路径实际上是一个文件。问题文件是.user.ini,它位于你的VuePress的dist文件夹中。
直接找到.user.ini文件,删除就可以了
报错3 —— npm 安装报错
LPrincess@DESKTOP-6GAKQI6 ~ npm install -g npm
npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path C:\Program Files\nodejs\node_cache\_cacache\tmp\eb2f0897
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, open 'C:\Program Files\nodejs\node_cache\_cacache\tmp\eb2f0897'
npm ERR! [Error: EPERM: operation not permitted, open 'C:\Program Files\nodejs\node_cache\_cacache\tmp\eb2f0897'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'open',
npm ERR! path: 'C:\\Program Files\\nodejs\\node_cache\\_cacache\\tmp\\eb2f0897'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
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! Log files were not written due to an error writing to the directory: C:\Program Files\nodejs\node_cache\_logs
npm ERR! You can rerun the command with --loglevel=verbose to see the logs in your terminal
解决方案:
- 第 1 步:以管理员身份运行
- 以管理员身份打开命令提示符或 PowerShell :
npm install -g npm
- 第 2 步:清除 npm 缓存
- 清除 npm 缓存:打开管理员命令提示符并运行:
npm cache clean --force
- 尝试再次安装 npm :
npm install -g npm
- 步骤 3:更改 npm 的缓存目录(可选)
- 为 npm 的缓存创建一个新目录(例如, C:\Users<YourUsername>.npm-cache )
npm config set cache C:\Users\<YourUsername>\.npm-cache --global
问题4 —— 找不到vue
- 配置全局安装目录:
npm config set prefix "E:\node\node_global" 配置全局安装位置 node-global 目录路径
npm config set cache "E:\node\node_cache" 配置缓存位置 node-cache 目录路径
- 全局安装:
npm install -g @vue/cli
- 配置环境变量
在环境变量-系统环境变量-PATH中添加:E:\node\node_global
未解决
(node:35012) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead. (Use node --trace-deprecation ... to show where the warning was created)
[@mdit/mathjax] "mathjax-full" is not installed!
error An unexpected error occurred:"https://registry.npm.taobao.org@mdit%2fmathjax-full: Not found".info If you think this is a bug, please open a bug report with the information provided in "E:\\Study\\blog\\vuepress\\yarn-error.log".info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
⠙ Rendering pages /[Vue warn]: Invalid vnode type when creating vnode: undefined.