新增:《解决 DotNET 安装完,报错:Couldn't find a valid ICU package installed on the system. Please install libicu using your package manager and try again》(侧边栏文章标题增加序号显示)

This commit is contained in:
2022-11-13 22:41:13 +08:00
parent c67dbaba2a
commit bedd34976d
7 changed files with 94 additions and 4 deletions

View File

@@ -29,7 +29,7 @@ docker logs prometheus
错误信息部分也很突出level=error。
```
```shell
caller=query_logger.go:90 level=error component=activeQueryTracker msg="Error opening quer log file" file=/opt/bitnami/prometheus/data/queries.active err="open data/queries.active: permission denied"
panic: Unable to create mmap-ed active query log
```
@@ -40,9 +40,7 @@ panic: Unable to create mmap-ed active query log
简单翻译一下错误信息 msg 及后面部分提示。
```
信息:打开查询日志文件时出错 file=/opt/bitnami/prometheus/data/queries.active 错误:打开 data/queries.active拒绝访问
```
> 信息:打开查询日志文件时出错 file=/opt/bitnami/prometheus/data/queries.active 错误:打开 data/queries.active拒绝访问
其中的关键信息是 `permission denied`(拒绝访问),从这字面意思上可以得知和权限有关。

View File

@@ -0,0 +1,70 @@
---
title: 解决 DotNET 安装完报错Couldn't find a valid ICU package installed on the system. Please install libicu using your package manager and try again
author: 查尔斯
date: 2022/11/06 15:35
categories:
- Bug万象集
tags:
- DotNET
- Linux
- CentOS
---
# 解决 DotNET 安装完报错Couldn't find a valid ICU package installed on the system. Please install libicu using your package manager and try again
## 问题描述
**C** 今天,笔者在一台 CentOS 7.9 服务器上手动安装完 DotNET 6.0.401 并配置好了环境变量之后,照例想查看一下是否安装成功。
```shell
dotnet --version
```
预想的版本信息没输出,倒是输出了这么一段错误。
![202211061520256](../../../../../public/img/2022/11/06/202211061520256.png)
```c#
Process terminated. Couldn't find a valid ICU package installed on the system. Please install libicu using your package manager and try again. Alternatively you can set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support. Please see https://aka.ms/dotnet-missing-libicu for more information.
at System.Environment.FailFast(System.String)
at System.Globalization.GlobalizationMode+Settings..cctor()
at System.Globalization.CultureData.CreateCultureWithInvariantData()
at System.Globalization.CultureData.get_Invariant()
at System.Globalization.CultureInfo..cctor()
at System.Globalization.CultureInfo.get_CurrentUICulture()
at System.TimeZoneInfo.GetUtcStandardDisplayName()
at System.TimeZoneInfo.CreateUtcTimeZone()
at System.TimeZoneInfo..cctor()
at System.DateTime.get_Now()
at Microsoft.DotNet.Cli.Program.Main(System.String[])
Aborted
```
<!-- more -->
## 原因分析
简单翻译一下关键错误信息。
> 进程终止。找不到系统上安装的有效 ICU 包。请使用包管理器安装 libicu然后重试。或者如果您想在不支持全球化的情况下运行可以将配置标志 System.Globalization.Invariant 设置为 true。请访问 https://aka.ms/dotnet-missing-libicu 了解更多信息。
从提示信息来看,问题的原因是当前系统没有安装 DotNet 需要的 `libicu` 库。
## 解决方案
实际上这也是因为笔者采用的手动安装方式才导致的问题,如果采用包管理器(在线)安装方式,这个 `libicu` 库会自动被安装好,也就不会出现这个问题了。
![202211061523521](../../../../../public/img/2022/11/06/202211061523521.png)
知道了问题的原因,那就安装一下这个依赖库。
```shell
yum -y install libicu
```
安装完后,再执行查看版本命令,版本信息正常输出了。
## 参考资料
1. 在 CentOS 上安装 .NET SDK 或 .NET 运行时https://learn.microsoft.com/zh-cn/dotnet/core/install/linux-centos
2. 用于全球化的运行时配置选项https://learn.microsoft.com/zh-cn/dotnet/core/runtime-config/globalization