1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee
epp/Solutions.md

109 lines
3.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 遇到的问题及对应的解决方案
### 2022.10
#### 2022.10.21 前端 npm run serve 时报错提示Module not found: Error: Can't resolve 'element-plus/lib/locale'
```bash
ERROR Failed to compile with 1 error
error in ./src/plugins/element.js
Module not found: Error: Can't resolve 'element-plus/lib/locale' in 'xxxxxxxx\src\plugins'
ERROR in ./src/plugins/element.js 3:0-45
Module not found: Error: Can't resolve 'element-plus/lib/locale' in 'xxxxxxxx\src\plugins'
@ ./src/main.js 4:0-51 6:0-18
webpack compiled with 1 error
```
解决方案:
安装`unplugin-vue-components` 和 `unplugin-auto-import`这两款插件
```bash
npm install -D unplugin-vue-components unplugin-auto-import
```
注意:安装时可能还会遇到下面一个错误,可以添加 `--legacy-peer-deps` 参数解决
参考https://element-plus.gitee.io/zh-CN/guide/quickstart.html#%E6%8C%89%E9%9C%80%E5%AF%BC%E5%85%A5
#### 2022.10.21 前端 npm install 时报错提示Conflicting peer dependency: eslint-plugin-vue@7.20.0
```bash
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @vue/eslint-config-standard@6.1.0
npm ERR! Found: eslint-plugin-vue@8.7.1
npm ERR! node_modules/eslint-plugin-vue
npm ERR! dev eslint-plugin-vue@"^8.0.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0
npm ERR! node_modules/@vue/eslint-config-standard
npm ERR! dev @vue/eslint-config-standard@"^6.1.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: eslint-plugin-vue@7.20.0
npm ERR! node_modules/eslint-plugin-vue
npm ERR! peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0
npm ERR! node_modules/@vue/eslint-config-standard
npm ERR! dev @vue/eslint-config-standard@"^6.1.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\Coz\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Coz\AppData\Local\npm-cache\_logs\2022-10-21T07_12_41_027Z-debug-0.log
```
解决方案:
在安装命令后加 `--legacy-peer-deps`
例如:`npm i --legacy-peer-deps`
参考https://blog.csdn.net/lanmy_dl/article/details/126346812
#### 2022.10.21 后端 项目创建后启动失败提示Failed to configure a DataSource: url attribute is not specified and no embedded datasource could be configured.
```bash
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to configure a DataSource: url attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
```
解决方案:
application.properties 配置文件中添加数据库配置
```bash
# MySQL配置
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/epp?useUnicode=true&characterEncoding=utf8&useSSL=false
spring.datasource.username=root
spring.datasource.password=root
```