Npm Socket timeout error while running tutor dev launch

Hey, I am trying to run openedx with tutor for local development. I was originally able to run it locally without any issues without mounting my local open edx directory. But I mounted local directory and since then tutor dev launch returns an error. The error is as follows:

npm ERR! network Invalid response body while trying to fetch Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network 
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! A complete log of this run can be found in:
npm ERR!     /openedx/.npm/_logs/2023-11-25T16_27_07_503Z-debug-0.log
Error: Command failed with status 1: docker compose -f /Users/ahmed_zubair/Library/Application Support/tutor-nightly/env/local/docker-compose.yml -f /Users/ahmed_zubair/Library/Application Support/tutor-nightly/env/dev/docker-compose.yml --project-name tutor_nightly_dev -f /Users/ahmed_zubair/Library/Application Support/tutor-nightly/env/local/ -f /Users/ahmed_zubair/Library/Application Support/tutor-nightly/env/dev/ run --rm lms-job sh -e -c # When a new local copy of edx-platform is bind-mounted, certain build
# artifacts from the openedx image's edx-platform directory are lost.
# We regenerate them here.

if [ -f /openedx/edx-platform/bindmount-canary ] ; then
	# If this file exists, then edx-platform has not been bind-mounted,
	# so no build artifacts need to be regenerated.
	echo "Using edx-platform from image (not bind-mount)."
	echo "No extra setup is required."

echo "Performing additional setup for bind-mounted edx-platform."
set -x # Echo out executed lines

# Regenerate Open_edX.egg-info
pip install -e .

# Regenerate node_modules
npm clean-install

# Regenerate static assets.
openedx-assets build --env=dev

set -x
echo "Done setting up bind-mounted edx-platform."

So far I have upgraded npm, increased fetch-retry-mintimeout and still it is giving the same error. Any leads on how this can be resolved?

It’s npm that is acting up. Usually, the only solution is to persevere… Just run the command again until it works.

What you need to understand is that npm runs inside a Docker container here, so you can’t really modify the npm configuration (including fetch-retry-mintimeout) from your host.

Actualy I have been trying this for 4 5 days now but running into the same issue everytime… I just updated my tutor nightly and also the local edx-platform to the latest commit. But still facing the same issue.

Is there a way that I can modify npm configurations for my Docker container?

If I add a command to update npm config in and rebuild the image, will it get updated?

You can try to modify the Dockerfile that is used to build the “openedx” Docker image. You should have a look at the “openedx-dockerfile-*” patches: Template patch catalog — Tutor documentation In particular, “openedx-dockerfile-pre-assets”.