The following occurs when installing npm prereqs within a fresh container:
This is a known issue with npm (https://github.com/npm/npm/issues/17444) and appears to be filesystem related. Here's what we know so far:
This issue only occurs on MacOS machines. Linux systems are fine.
The r.js issue occurs while npm is linking binaries (the final step of the npm install process)
We suspect it's due to some sort of filesystem race condition related to the container's mount of edx-platform.
This issue occurs when running npm install from within a Docker container. It occurs on both clean and dirty devstacks.
The r.js error always happens when no package-lock.json exists within edx-platform.
When package-lock.json exists within edx-platform, the r.js error occurs sporadically, but frequently enough to be a nuisance.
Sometimes, running npm install twice back to back succeeds, but not always.
Running npm install from the host succeeds, but it adds an erroneous package fsevents to the package-lock.json. This package is MacOS-specific, may cause install errors on containers, and should not be checked into git.
Installation succeeds when running npm install --no-bin-links (or adding bin-links = false to edx-platform's .npmrc). However, this causes problems later on because many of edx-platform's processes rely on those binary links.
The r.js error continued to occur after changing the docker mounts for edx-platform to :delegated