Description
Related to #30825 (I had the idea during its discussion) and, from the icebox, #3460
Is your feature request related to a problem? Please describe.
Currently, Node with an invalid/missing ICU data directory ( set with NODE_ICU_DATA or --icu-data-dir ) just fails.
$ nvm i --lts
Installing latest LTS version.
v12.16.1 is already installed.
$ node --icu-data-dir=/tmp
node: could not initialize ICU (check NODE_ICU_DATA or --icu-data-dir parameters)
Describe the solution you'd like
It might be possible to fall back as if the --icu-data-dir
was not specified (or the default data dir in #30825 was not present.)
As early as that error message is generated, it might be possible to call u_cleanup()
to unload ICU and then reinitialize it using the baked-in data or other defaults.
This could be done completely within InitializeICUDirectory()
, although it might be advantageous to allow programmatic detection of the fact that this fallback happened. Ideas there:
- expose
const char *u_getDataDirectory()
via the ICU process binding. - provide the eventual path string via some kind of variable
print out a warning(not a good idea)- some other flag
- do nothing - this would probably be OK if there isn't a strong use case (other than perhaps test cases)
FYI @sam-github @sgallagher @nodejs/i18n-api
Describe alternatives you've considered
There's really no alternative to restarting the node process at this point.