Node - Cannot find module 'unicode/category/So

The stack you’re using:

Node version: 4.4.4
yarn 0.16.1

The exact error message you are getting

Cannot find module 'unicode/category/So

Which troubleshooting steps you’ve already taken

  1. I found this issue on github: Cannot find module 'unicode/category/So' · Issue #58 · dodo/node-slug · GitHub. This is the library I’m using that depends on unicode and other people run into this issue on various platforms.
  2. The core issue seems to be that the unicode-data .txt file does not get downloaded and saved to the system. The unicode module needs this data file to exist.
  3. The reason the file cannot get downloaded is likely because the pre-test commands run from behind a proxy in circle.
  4. proposed fixes that should work on ubuntu have been:
  • install unicode data text file onto the system with apt-get sudo apt-get install unicode-data
  • install unicode data text file onto the system manually and export ENV variable: cd /tmp && wget http://unicode.org/Public/UNIDATA/UnicodeData.txt and setting this env var in machines: NODE_UNICODETABLE_UNICODEDATA_TXT:/tmp/UnicodeData.txt
  1. None of these proposed solutions are working, still by the time the test commands get run the module cannot be loaded.
  2. Interestingly, doing a “Rebuild without cache” fixes the issue and works every time.

What happens when you run the tests locally

It works and finds the module

What is supposed to happen when your build runs

The node process should be able to find module 'unicode/category/So


More info:

circle.yml (pieces taken from the guide Welcome to CircleCI Documentation - CircleCI):

dependencies:
  pre:
    - |
      if [[ ! -e ~/.yarn/bin/yarn || $(yarn --version) != "${YARN_VERSION}" ]]; then
        curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version $YARN_VERSION
      fi
    - sudo apt-get update -qq
  cache_directories:
    - ~/.yarn
    - ~/.cache/yarn
machine:
  YARN_VERSION: 0.16.1
  PATH: "${PATH}:${HOME}/.yarn/bin:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin"

One thing I tried that I thought would work based on this: GitHub - dodo/node-unicodetable: unicode lookup table is adding a pre line:

    - cd /tmp && wget http://unicode.org/Public/UNIDATA/UnicodeData.txt

and adding an env var:

NODE_UNICODETABLE_UNICODEDATA_TXT: /tmp/UnicodeData.txt
  • When I do this, and log at the beginning of the process that runs that test I can see that the UnicodeData.txt exists and that the env var is set.