Thingsboard 编译前端 ui-ngx 踩坑记录

  1. 在 IDEA 中进行 mvn clean install -Dmaven.test.skip=true 进行编译,在 ui-ngx 模块报错。
    [INFO] -----------------------< org.thingsboard:ui-ngx >-----------------------
    [INFO] Building ThingsBoard Server UI 3.3.0                              [1/15]
    [INFO] --------------------------------[ jar ]---------------------------------
    [INFO] 
    [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ ui-ngx ---
    [INFO] Deleting D:\IDEA-workspace\iot\thingsboard\ui-ngx\target
    [INFO] 
    [INFO] --- frontend-maven-plugin:1.12.0:install-node-and-yarn (install node and npm) @ ui-ngx ---
    [INFO] Installing node version v12.16.1
    [INFO] Copying node binary from C:\Users\付康\.m2\repository\com\github\eirslett\node\12.16.1\node-12.16.1-win-x64.exe to D:\IDEA-workspace\iot\thingsboard\ui-ngx\target\node\node.exe
    [INFO] Installed node locally.
    [INFO] Installing Yarn version v1.22.4
    [INFO] Unpacking C:\Users\付康\.m2\repository\com\github\eirslett\yarn\1.22.4\yarn-1.22.4.tar.gz into D:\IDEA-workspace\iot\thingsboard\ui-ngx\target\node\yarn
    [INFO] Installed Yarn locally.
    [INFO] 
    [INFO] --- frontend-maven-plugin:1.12.0:yarn (yarn install) @ ui-ngx ---
    [INFO] Running 'yarn install' in D:\IDEA-workspace\iot\thingsboard\ui-ngx
    [INFO] yarn install v1.22.4
    [INFO] warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
    [INFO] [1/4] Resolving packages...
    [INFO] [2/4] Fetching packages...
    [INFO] error Command failed.
    [INFO] error Command failed.info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
    [INFO] Exit code: 128
    [INFO] Command: git
    [INFO] Arguments: ls-remote --tags --heads git://github.com/thingsboard/flot.git
    [INFO] Directory: D:\IDEA-workspace\iot\thingsboard\ui-ngx
    [INFO] Output:
    [INFO] fatal: unable to connect to github.com:
    [INFO] github.com[0: 140.82.112.4]: errno=Unknown error
    
    
  2. 首先排查 github.com 域名解析,通过 https://ipaddress.com/website/github.com 获取最新 ip 并写入 hosts 文件。【无效】
  3. 日志中出现 git://github.com/thingsboard/flot.git ,查看文件发现其中三个依赖组件是 git://xxx.git 格式,经查资料已经被 github 禁用了,需要转换为 https://
    git config --global url."https://".insteadOf git://
    
    执行失败:
    D:\IDEA-workspace\iot\thingsboard\ui-ngx>git config --global url."https://".insteadOf git://
    Rename from 'C:/Users/abc/.gitconfig.lock' to 'C:/Users/abc/.gitconfig' failed. Should I try again? (y/n) y
    
    去掉 --global 参数成功,或者手动编辑用户目录下的 .gitconfig 文件,添加如下:
    [url "https://"]
    	insteadOf = git://
    
  4. 再次执行,报新错误
    Output:
    fatal: unable to access 'https://github.com/thingsboard/flot.git/': OpenSSL SSL_read: Connection was reset, errno 10054
    info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
    
  5. 设置不进行 https 验证
    git config http.sslVerify "false"
    
  6. 再次执行 yarn install 即可
    D:\IDEA-workspace\iot\thingsboard\ui-ngx>yarn install
    yarn install v1.22.4
    warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
    [1/4] Resolving packages...
    [2/4] Fetching packages...
    info [email protected]: The platform "win32" is incompatible with this module.
    info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
    info [email protected]: The platform "win32" is incompatible with this module.
    info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
    info [email protected]: The platform "win32" is incompatible with this module.
    info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
    [3/4] Linking dependencies...
    warning " > @material-ui/[email protected]" has unmet peer dependency "@date-io/core@^1.3.6".
    warning " > @ngrx/[email protected]" has incorrect peer dependency "@angular/core@^10.0.0".
    ...
    [4/4] Building fresh packages...
    Done in 221.51s.
    
  7. 如果依旧失败,建议在 windows 中下载安装 nodejs 和 yarn 程序,在 ui-ngx 目录下命令行中执行 yarn install 命令。

你可能感兴趣的:(Thingsboard,ui,前端,git)