Jupyter lab 4.0.6 error on startup about yarn configuration and worker_threads

I’m getting the following error when starting jupyter lab:

% Fail to get yarn configuration. internal/modules/cjs/loader.js:582
    throw err;
    ^

Error: Cannot find module 'worker_threads'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
    at Function.Module._load (internal/modules/cjs/loader.js:506:25)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at /misc/working/projects/pysicr/test_deployment/lib/python3.9/site-packages/jupyterlab/staging/yarn.js:423:2576
    at Object.<anonymous> (/misc/working/projects/pysicr/test_deployment/lib/python3.9/site-packages/jupyterlab/staging/yarn.js:743:8770)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)

This is not fatal. Things seem to be working fine anyway, but I have not tested a lot of stuff.

Jupyter is installed in a vitualenv with python 3.9 in centos 7.

The only changes I had to make during the installation was to downgrade urllib3 to <2.0, because the default installed as a requirement was giving other errors.

Thanks,
JP

Thanks for the report. What version of nodejs is this against?

If this is a “long term” build that will be frequently restarted, one can also configure the startup to avoid all nodejs-based things, which generally are neither useful or interesting for 4.x (which generally prefers pre-built extensions):

https://jupyterlab.readthedocs.io/en/stable/user/directories.html#disabling-rebuild-checks

e.g. in jupyter_server_config.json:

{
  "LabApp": {
    "tornado_settings": {
      "page_config_data": {
        "buildCheck": false,
        "buildAvailable": false,
      }
    }
  }
}

This can help both startup time and stability.

Are you saying these errors are not related to the operation of Jupyter server or lab, and it’s something about the build check on startup?

My use case is that I have several users and I try to maintain a common stable environment for them. But people are starting/restarting Jupyter all the time. If this error is harmless, then I’d be happy to find a way to suppress it / prevent it.

I will try your suggestions.

Similar issue as jpcarm

Fail to get yarn configuration. internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module 'worker_threads'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at /home/luca/mambaforge/lib/python3.10/site-packages/jupyterlab/staging/yarn.js:423:2576
    at Object.<anonymous> (/home/luca/mambaforge/lib/python3.10/site-packages/jupyterlab/staging/yarn.js:743:8770)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)

This message is no longer showing after updating node.js .
The easiest way to update on my system (linux mint) was to use NVM.
install node.js on Linux Mint

using

Step 2: Install Node.js via NVM

Hope it helps