【博客搭建】1、拾壹博客本地启动遇到的问题和需要注意的坑

一、后端(blog)启动

1、修改application.yml中的数据库链接与密码,Redis账号密码,即可启动成功;

2、运行之前先导入sql;

3、 如需上传文件保存至本地(例如相册的照片),需执行以下操作:
3.1 启动项目后第一时间把 “系统配置”–》“系统配置” 中的文件保存先切换至本地保存

3.2 “系统配置”–》“本地文件存储” 中的本地文件域名修改为 http://localhost:8800/jpg/ (项目路径/jpg ,这个jpg对应下面新增JpgPathConfig.java文件中配置的虚拟路径)
3.3 application.yml中把 upload-folder上传照片的路径修改成本地实际上传路径:

4、页面只需要在img标签中使用/img/xxx.jpg即可直接访问图片(注意拦截器中是拦截访问/img/**路径下才会被转到图片的实际路径中) 

二、前端前台(blog-web)启动

shiyi-blog-master\blog-web(前台的前端)根目录下打开cmd ,运行

npm install --registry=https://registry.npmmirror.com ,依赖安装完毕,使用npm run serve 启动测试环境,如果有以下报错信息:
 

This may cause things to work incorrectly. Make sure to use the same version for both.
If you are using vue-loader@>=10.0, simply update vue-template-compiler.
If you are using vue-loader@<10.0 or vueify, re-installing vue-loader/vueify should bump vue-template-compiler to the latest.

执行npm i [email protected] --save ,2.7.14对应的是当前试用的vue的版本,意思是把某个依赖的版本升级到vue2.7.14对应的版本,再次启动项目,如果还是报错,那么就直接执行npm audit fix --registry=https://registry.npmmirror.com 来修复各依赖的版本,使其对应vue2.7.14的版本修复完毕再次启动项目
 

然后启动(npm run serve)成功,访问:http://localhost:80/就好了

三. 前端后台(blog-admin)启动

 执行npm install --registry=https://registry.npmmirror.com

 注意启动方法是npm run dev,而不是前台的npm run serve否则无法启动成功。

npm notice
npm notice New major version of npm available! 8.19.2 -> 9.6.2
npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.6.2
npm notice Run npm install -g [email protected] to update!
npm notice 

那就升级npm
npm install -g [email protected] ------升级后就ok了

猜你喜欢

转载自blog.csdn.net/wufaqidong1/article/details/133729989