2022-10-21 14:58:33 +08:00
|
|
|
|
# 遇到的问题及对应的解决方案
|
2022-10-21 01:21:21 +08:00
|
|
|
|
|
|
|
|
|
### 2022.10
|
|
|
|
|
|
2022-10-22 22:38:41 +08:00
|
|
|
|
#### 2022.10.22 CRLF换行替换为LF
|
|
|
|
|
|
|
|
|
|
VSCode:安装 `EditorConfig for VS Code` 插件,然后添加 `.editorconfig` 文件:
|
|
|
|
|
|
|
|
|
|
```ini
|
|
|
|
|
# http://editorconfig.org
|
|
|
|
|
root = true
|
|
|
|
|
|
|
|
|
|
[*]
|
|
|
|
|
end_of_line = lf
|
|
|
|
|
|
|
|
|
|
[*.md]
|
|
|
|
|
insert_final_newline = false
|
|
|
|
|
trim_trailing_whitespace = false
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
IDEA:File → File Properties → Line Separators → LF - Unix and macOS (\n)
|
|
|
|
|
|
|
|
|
|
参考:
|
|
|
|
|
|
|
|
|
|
https://juejin.cn/post/6860322397447258119
|
|
|
|
|
|
|
|
|
|
https://blog.csdn.net/Li_haiyu/article/details/123852105
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-21 15:48:56 +08:00
|
|
|
|
#### 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.
|
2022-10-21 01:21:21 +08:00
|
|
|
|
|
|
|
|
|
```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
|
|
|
|
|
```
|
|
|
|
|
|