Help Request: ModuleNotFoundError: No module named ‘_sass’ when building Open edX with Tutor
I’ve been struggling to set up an Open edX instance using Tutor and consistently encounter the following error during image building:
ModuleNotFoundError: No module named ‘_sass’
Dockerfile:212
210 | # will be processed. This makes the docker image lighter and faster to build.
211 | RUN npm run postinstall # Postinstall artifacts are stuck in nodejs-requirements layer. Create them here too.
212 | >>> RUN npm run compile-sass – --skip-themes
213 | RUN npm run webpack
214
ERROR: failed to solve: process “/bin/sh -c npm run compile-sass – --skip-themes” did not complete successfully: exit code: 1
What I’ve tried so far:
Used both Tutor 19.0.0 and 19.0.2 versions
Switched from Python 3.10 to Python 3.11
Deleted and recreated the virtual environment
Completely wiped and re-cloned the edx-platform repository
Cleaned Docker cache and removed all containers before rebuilding
Ran tutor config save to create fresh configuration
Ran tutor build --no-cache to avoid caching issues
I’ve seen references to node-sass compatibility issues in Stack Overflow and the Open edX forums, with suggestions to update the node-sass version in package.json, but nothing has worked so far.
When running tutor dev launch or any tutor build command, I consistently hit this error. My goal is to eventually mount my local edx-platform directory to Tutor for customization, but I can’t even get past the initial build.
Has anyone encountered this specific issue with Tutor 19.x and found a working solution? Any guidance would be greatly appreciated!
Additional environment details:
Thank you in advance for any help!
Feel free to fill in the additional environment details at the bottom with your specific system information before posting.
Hey @leo98ber , I think we talked in Slack. Do you mind explaining here how you resolved your problem, so that others could use that information if they hit the same problem?
I believe this was due to a mismatch between the poster’s Tutor version and their edx-platform repo version. In particular, older versions of edx-platform installed sass through requirements/edx/base.txt., whereas newer versions of edx-platform install _sass through a separate requirements/edx/assets.txt (in order to slim down the base image build). Newer Tutor versions account for this by installing assets.txt before compiling Sass, whereas older versions don’t.
When mounting a local edx-platform repository, one should use Tutor Main if their branch is close to edx-platform master, and they should they should use the corresponding compatible Tutor numbered release if their branch is closed to an edx-platform named release.
@tonybusa let me know if that doesn’t resolve this for you.
That makes sense. I am having trouble figuring out how to switch between Tutor Main and a Tutor numbered release.
Perhaps because I installed tutor NOT behind a virtual environment originally. So now even when I do install it WITHIN a virtual environment it still shows a versioned number:
(.venv) tony.busa tutor % git branch
* main
(.venv) tony.busa edx-platform % tutor --version
tutor, version 19.0.2
Purged my docker environment again, then “tutor dev launch” completed successfully. However, I did need to “tutor dev stop”, “tutor dev start” for the site to load properly.