Search code examples
node.jsnode-modulesicu

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


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?


Solution

  • 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.