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

135 lines
4.2 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.

## 环境安装
### cnpm
```bash
# electron 需要使用 cnpm 安装依赖
npm install -g cnpm --registry=https://registry.npmmirror.com
```
## 环境变量检查
如果希望查看环境变量是否配置成功,可以使用以下命令:
(下面以 Windows 下命令说明Linux 系统下 `echo %变量名%` 需要改成 `echo $变量名`
```bash
echo %PATH%
# 您会看到以;分隔的很多路径,其中应该包括:
# JDK 所在文件夹下的 bin 目录:...\openjdk-11\bin
# Maven 所在文件夹下的 bin 目录:...\apache-maven-3.6.3\bin
echo %JAVA_HOME%
# 您会看到 JDK 所在文件夹
echo %MAVEN_HOME%
# 您会看到 Maven 所在文件夹
```
如果希望查看环境是否安装成功或安装的环境版本,可以使用以下命令:
```bash
# 查看 Git 版本
git --version
# 您应该看到类似如下输出👇
# git version 2.35.1.windows.2
# 查看 MySQL 版本(如果 MySQL 的 bin 目录没有配在环境变量中,则需要先 cd 切换到 bin 目录下)
mysql --version
# 您应该看到类似如下输出👇
# mysql Ver 8.0.12 for Win64 on x86_64 (MySQL Community Server - GPL)
# 查看 JDK 版本
java -version
# 您应该看到类似如下输出👇
# openjdk version "11" 2018-09-25
# OpenJDK Runtime Environment 18.9 (build 11+28)
# OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)
# 查看 Maven 版本
mvn -v
# 您应该看到类似如下输出👇
# Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
# Maven home: xxxxxx\apache-maven-3.6.3\bin\..
# Java version: 11, vendor: Oracle Corporation, runtime: xxxxxx\openjdk-11
# Default locale: zh_CN, platform encoding: GBK
# OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
# 查看 node 版本
node -v
# 您应该看到类似如下输出👇
# v14.18.0
# 查看 npm 版本
npm -v
# 您应该看到类似如下输出👇
# 8.19.2
# 查看 cnpm 版本
cnpm -v
# 您应该看到类似如下输出👇
# cnpm@8.4.0 (C:\Users\Coz\AppData\Roaming\npm\node_modules\cnpm\lib\parse_argv.js)
# npm@8.19.2 (C:\Users\Coz\AppData\Roaming\npm\node_modules\cnpm\node_modules\npm\index.js)
# node@14.18.0 (D:\Program\Development\Environment\nodejs\node.exe)
# npminstall@6.5.2 (C:\Users\Coz\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\lib\index.js)
# prefix=C:\Users\Coz\AppData\Roaming\npm
# win32 x64 10.0.22621
# registry=https://registry.npmmirror.com
```
## 配置国内镜像源
Maven 镜像源配置(下面以阿里云镜像为例,其他镜像可自行替换):
用编辑器打开 maven 目录下 conf/settings.xml 文件,找到如下位置,将 `<mirror></mirror>` 部分粘贴进去:
```xml
<!-- mirrors
| This is a list of mirrors to be used in downloading artifacts from remote repositories.
|
| It works like this: a POM may declare a repository to use in resolving certain artifacts.
| However, this repository may have problems with heavy traffic at times, so people have mirrored
| it to several places.
|
| That repository definition will have a unique id, so we can create a mirror reference for that
| repository, to be used as an alternate download site. The mirror site will be the preferred
| server for that repository.
|-->
<mirrors>
<!-- mirror
| Specifies a repository mirror site to use instead of a given repository. The repository that
| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
|
<mirror>
<id>mirrorId</id>
<mirrorOf>repositoryId</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://my.repository.com/repo/path</url>
</mirror>
-->
<!-- ######## 👇👇👇将以下部分粘贴进去👇👇👇 ######## -->
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>https://maven.aliyun.com/repository/public</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!-- ######## 👆👆👆将以上部分粘贴进去👆👆👆 ######## -->
</mirrors>
```
npm 镜像源配置(下面以淘宝镜像为例,其他镜像可自行替换):
```bash
# 配置镜像源
npm config set registry https://registry.npm.taobao.org/
# 配置后可通过以下命令查看是否配置成功
npm config get registry
```