AWS Lambda Node.js Full-ICU [英] AWS Lambda Node.js Full-ICU

查看:149
本文介绍了AWS Lambda Node.js Full-ICU的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下命令在本地运行node.js应用程序:

I run node.js app localy with this command:

$ node --icu-data-dir=node_modules/full-icu app.local.js

如何在AWS Lambda环境中指定icu-data-dir?

How to specify icu-data-dir in AWS Lambda environment?

谢谢

推荐答案

您应该设置NODE_ICU_DATA环境变量,以便它指向可以找到正确的ICU .dat文件的目录.

You should set the NODE_ICU_DATA environment variable so that it points to a directory where the correct ICU .dat file can be found.

如果使用与lambda所使用的节点版本匹配的节点版本安装full-icu软件包,则应自动获取正确的.dat文件.例如.使用运行时nodejs10.x时:

If you install the full-icu package using the node version that matches the one used by your lambdas, you should automatically get the correct .dat file. E.g. when using the runtime nodejs10.x:

npx -p node@10.x npm i full-icu

这将安装node_modules/full-icu/,您应该在该目录中看到文件icudt62l.dat.文件的确切名称取决于您使用的节点的版本.

This installs node_modules/full-icu/, and you should see the file icudt62l.dat in that directory. The exact name of the file depends on the version of node you're using.

如果将整个node_modules目录作为lambda的一部分进行部署,则NODE_ICU_DATA=node_modules/full-icu/(相当于NODE_ICU_DATA=/var/task/node_modules/full-icu)应该可以工作.否则,您可以仅将.dat文件作为lambda的一部分进行部署,并将NODE_ICU_DATA指向部署文件的目录.

If you're deploying the whole node_modules directory as part of your lambda, NODE_ICU_DATA=node_modules/full-icu/ (equivalent to NODE_ICU_DATA=/var/task/node_modules/full-icu) should work. Otherwise, you can deploy just the .dat file as part of your lambda and point NODE_ICU_DATA at the directory where you deployed the file.

如果仍然出现错误,并且确定NODE_ICU_DATA正确,请确保.dat文件版本正确.

If you're still getting an error and you're sure that NODE_ICU_DATA is correct, make sure that the .dat file version is correct.

这篇关于AWS Lambda Node.js Full-ICU的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆