node: could not initialize ICU (check NODE_ICU_DATA or --icu-data-dir parameters)

Pooja Gurav picture Pooja Gurav · May 11, 2018 · Viewed 14.7k times · Source

I was trying to upgrade node version on our CI environment from node 6 to node 8. I updated the full-icu version as well.

the $NODE_ICU_DATA is set to /usr/lib/node_modules/full-icu

but still get this error

node: could not initialize ICU (check NODE_ICU_DATA or --icu-data-dir parameters)

Any idea, how to fix this?

Answer

Steven R. Loomis picture Steven R. Loomis · May 15, 2018

You need to run npm install including the full-icu package. It's full-icu's postinstall step which downloads the appropriate bits for the currently executing node. Note that multiple files may show up in the full-icu directory, that's OK.

If you already had full-icu installed, but upgraded Node.js in between:

npm rebuild

fixes the issue.