刚入行新人,部门未来使用若依框架进行开发,转载前辈遇到的问题,并记录自己的使用
原文链接:https://blog.csdn.net/m0_53313913/article/details/112452126
运行:
#后端
1.创建数据库ry-vue
并导入数据脚本ry_2021xxxx.sql
,quartz.sql
2.打开项目运行com.ruoyi.RuoYiApplication.java
,出现如下图表示启动成功
#前端
# 进入项目目录
cd ruoyi-ui
# 安装依赖
npm install
# 强烈建议不要用直接使用 cnpm 安装,会有各种诡异的 bug,可以通过重新指定 registry 来解决 npm 安装速度慢的问题。
npm install --registry=https://registry.npmmirror.com
# 本地开发 启动项目
npm run dev
输入:(http://localhost:80 (opens new window)) 默认账户/密码 admin/admin123
问题:
#后端
1.注意配置中的mysql的密码和数据库是否正确
2.Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘sysConfigController’: Unsatisfied dependency expressed through field ‘configService’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sysConfigServiceImpl’: Invocation of init method failed; nested exception is org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis; nested exception is org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to localhost:6379
原因:没有安装redis(注意)要把redis服务开启才可以跑起来,用dos窗口进入redis跟目录输入redis-server redis.windows.conf
下载网址:https://github.com/tporadowski/redis/releases。
前端
1.在src中的env.development中修改成VUE_APP_BASE_API = ‘http://localhost:8080/citywater’(8080是自己在后端server配置中设置的接口,citywater是自己在后端server中context-path的内容)
2.添加npm(这个要下载nodejs)再配置,但是会报这个错
‘vue-cli-service’ 不是内部或外部命令,也不是可运行的程序
或批处理文件。
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ruoyi@3.3.0 dev: vue-cli-service serve
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ruoyi@3.3.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\blingbling\AppData\Roaming\npm-cache_logs\2021-01-10T10_04_42_947Z-debug.log
解决方案:下一个nodejs之后.在dos窗口中可以用node-v和npm -v检查是否安装成功再用。用dos命令进入若依前段项目ruoyi-ui中输入npm install --registry=thhp://registry.npm.taobao.org;
前后端要同时运行才可以进入