首页 > 系统相关 >【Azure App Service for Linux】NodeJS镜像应用启动失败,遇见 RangeError: Incorrect locale information provided

【Azure App Service for Linux】NodeJS镜像应用启动失败,遇见 RangeError: Incorrect locale information provided

时间:2023-08-29 20:34:53浏览次数:55  
标签:Incorrect information 21 provided 08 server web 2023 29T11

问题描述

在App Service For Linux 中,部署NodeJS应用,应用启动失败。

报错信息为:

2023-08-29T11:21:36.329731566Z RangeError: Incorrect locale information provided
2023-08-29T11:21:36.329776866Z at Intl.getCanonicalLocales (<anonymous>)
2023-08-29T11:21:36.329783066Z at CanonicalizeLocaleList (/app/web/.next/server/chunks/8112.js:396:17)
2023-08-29T11:21:36.329797266Z at match (/app/web/.next/server/chunks/8112.js:656:108)
2023-08-29T11:21:36.329801166Z at getLocaleOnServer (/app/web/.next/server/chunks/7614.js:162:63)
2023-08-29T11:21:36.329804566Z at LocaleLayout (/app/web/.next/server/chunks/7614.js:89:55)
2023-08-29T11:21:36.329808467Z at X (/app/web/.next/server/chunks/8112.js:2419:13)
2023-08-29T11:21:36.329811967Z at Na (/app/web/.next/server/chunks/8112.js:2587:21)
2023-08-29T11:21:36.329815367Z at Array.toJSON (/app/web/.next/server/chunks/8112.js:2347:20)
2023-08-29T11:21:36.329818767Z at stringify (<anonymous>)
2023-08-29T11:21:36.329822167Z at da (/app/web/.next/server/chunks/8112.js:1861:9)
2023-08-29T11:21:36.339132982Z [Error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.] {
2023-08-29T11:21:36.339162983Z digest: '833304465'
2023-08-29T11:21:36.339168383Z }

 

问题解答

当前App Service 应用使用 node:18 的镜像启动,这个镜像是基于Debian的,且没有安装locales相关packages。

在镜像(Dockerfile)中加入以下命令可以成功启动:

RUN apt-get update
RUN apt-get -y install locales
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \
locale-gen
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

 



当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!

标签:Incorrect,information,21,provided,08,server,web,2023,29T11
From: https://blog.51cto.com/u_13773780/7279742

相关文章