Skip to content
Daniel Matsuda edited this page Nov 23, 2021 · 3 revisions

We've added some common errors down below

Python environment setup

Windows Specific

  • If the command poetry run lint fails with the error No module named *.py (fatal):
    • Locate the scripts.py file in the project's root directory. Replace line 21 of scripts.py (for path in [...]) with the following:
        for path in ["tests", "electricitymap", "./__init__.py", "./scripts.py", "./test_parser.py"]:
    
  • If the command poetry run test fails with the error ModuleNotFoundError: No module named 'electricitymap.contrib.parsers':
    • Enter administrator mode in the command prompt and delete the symlink file located at {path to your project}\electricitymap-contrib\electricitymap\contrib\parsers. Then, run the following command (replacing {path to your project} as needed) to create a new Windows symlink:
    mklink /D "{path to your project}\electricitymap-contrib\electricitymap\contrib\parsers" "{path to your project}\electricitymap-contrib\parsers"
    

Running the frontend map locally

  • ERROR: for X Cannot create container for service X: Invalid bind mount spec "<path>": Invalid volume specification: '<volume spec>'. If you get this error after running docker-compose up on Windows, you should tell docker-compose to properly understand Windows paths by setting the environment variable COMPOSE_CONVERT_WINDOWS_PATHS to 0 by running setx COMPOSE_CONVERT_WINDOWS_PATHS 0. You will also need a recent version of docker-compose. We have successfully seen this fix work with v1.13.0-rc4. More info here: https://github.com/docker/compose/issues/4274.

  • No website found at http://localhost:8000: This can happen if you're running Docker in a virtual machine. Find out docker's IP using docker-machine ip default, and replace localhost by your Docker IP when connecting.

Windows Specific

  • FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory. You can configure the memory allocation using NODE_OPTIONS=--max-old-space-size=4096 in the "build-release" script in package.json, example: export NODE_OPTIONS=--max-old-space-size=4096 NODE_ENV=production && webpack --bail --mode production. Also update the node version (last working version was v12.16.3).

  • Expected linebreaks to be 'LF' but found 'CRLF': Configure your IDE to use LF instead of CRLF. If that doesn't fix it, add "linebreak-style": 0 in "rules" in .estlintrc

  • ERROR: for electricitymap-contrib_mockserver_1 Cannot start service mockserver: OCI runtime create failed: container_linux.go:345: starting container process caused "process_linux.go:424: container init caused \"rootfs_linux.go:58: mounting \\\".../server.py\\\" to rootfs \\\"/mnt/sda1/var/lib/docker/overlay2/.../merged\\\" at \\\".../server.py\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type.

    • Check that the project is cloned under C:/Users/
  • nodemon not restarting on file changes: try adding the -L parameter to use the legacy watch: "server-dev": "nodemon server.js -L". See https://www.npmjs.com/package/nodemon#application-isnt-restarting

Clone this wiki locally