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

1 Like

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

1 Like

Hi,

I am beginning with Jupyter lab (running on Windows) and I have an error which seems similar to jpcaram.

May someone explain what does it mean and how to fix it if required ?

‘’’
C:\Users\paulb>jupyter lab
Fail to get yarn configuration.
C:\Users\paulb\AppData\Local\Programs\Python\Python313\Lib\site packages\jupyterlab\staging\yarn.js:4
(()=>{var Qge=Object.create;var AS=Object.defineProperty;var
bge=Object.getOwnPropertyDescriptor;var Sge=Object.getOwnPropertyNames;var vge=Object.getPrototypeOf,xge=Object.prototype.hasOwnProperty;var J=(r=>typeof require<“u”?require:typeof Proxy<“u”?new Proxy(r,{get:(e,t)=>(typeof require<“u”?require:e)[t]}):r)(function(r){if(typeof require<“u”)return require.apply(this,arguments);throw new Error(‘Dynamic require of "’+r+‘" is not supported’)});var Pge=(r,e)=>()=>(r&&(e=r(r=0)),e);var w=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),ut=(r,e)=>{for(var t in e)AS(r,t,{get:e[t],enumerable:!0})},Dge=(r,e,t,i)=>{if(e&&typeof e==“object”||typeof e==“function”)for(let n of Sge(e))!xge.call(r,n)&&n!==t&&AS(r,n,{get:()=>e[n],enumerable:!(i=bge(e,n))||i.enumerable});return r};var Pe=(r,e,t)=>(t=r!=null?Qge(vge(r)):{},Dge(e||!r||!r.__esModule?AS(t,“default”,{value:r,enumerable:!0}):t,r));var QK=w((GXe,BK)=>

SyntaxError: Unexpected token {
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.runMain (module.js:611:10)
at run (bootstrap_node.js:387:7)
at startup (bootstrap_node.js:153:9)

[I 2025-06-15 15:26:24.097 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2025-06-15 15:26:24.103 ServerApp] jupyter_server_terminals | extension was successfully linked.
[I 2025-06-15 15:26:24.110 ServerApp] jupyterlab | extension was successfully linked.
[I 2025-06-15 15:26:24.552 ServerApp] notebook_shim | extension was successfully linked.
[I 2025-06-15 15:26:24.599 ServerApp] notebook_shim | extension was successfully loaded.
[I 2025-06-15 15:26:24.601 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2025-06-15 15:26:24.601 ServerApp] jupyter_server_terminals | extension was successfully loaded.
[I 2025-06-15 15:26:24.605 LabApp] JupyterLab extension loaded from C:\Users\paulb\AppData\Local\Programs\Python\Python313\Lib\site-packages\jupyterlab
[I 2025-06-15 15:26:24.605 LabApp] JupyterLab application directory is C:\Users\paulb\AppData\Local\Programs\Python\Python313\share\jupyter\lab
[I 2025-06-15 15:26:24.606 LabApp] Extension Manager is ‘pypi’.
[I 2025-06-15 15:26:25.048 ServerApp] jupyterlab | extension was successfully loaded.
[I 2025-06-15 15:26:25.050 ServerApp] Serving notebooks from local directory: C:\Users\paulb
[I 2025-06-15 15:26:25.050 ServerApp] Jupyter Server 2.16.0 is running at:
[I 2025-06-15 15:26:25.050 ServerApp] http://localhost:8888/lab?token=1bd46ce1d22abb4bf003d14d857a9d4ee0f7949656b9f343
[I 2025-06-15 15:26:25.051 ServerApp] http://127.0.0.1:8888/lab?token=1bd46ce1d22abb4bf003d14d857a9d4ee0f7949656b9f343
[I 2025-06-15 15:26:25.051 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2025-06-15 15:26:25.087 ServerApp]

To access the server, open this file in a browser:
    file:///C:/Users/paulb/AppData/Roaming/jupyter/runtime/jpserver-6532-open.html
Or copy and paste one of these URLs:
    http://localhost:8888/lab?token=1bd46ce1d22abb4bf003d14d857a9d4ee0f7949656b9f343
    http://127.0.0.1:8888/lab?token=1bd46ce1d22abb4bf003d14d857a9d4ee0f7949656b9f343

[I 2025-06-15 15:26:25.221 ServerApp] Skipped non-installed server(s): bash-language-server, dockerfile-language-server-nodejs, javascript-typescript-langserver, jedi-language-server, julia-language-server, pyright, python-language-server, python-lsp-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-languageserver-bin, vscode-html-languageserver-bin, vscode-json-languageserver-bin, yaml-language-server
[W 2025-06-15 15:26:28.113 LabApp] Could not determine jupyterlab build status without nodejs
[I 2025-06-15 15:26:29.264 ServerApp] Kernel started: a9383ec0-73c0-44ba-be4b-55a14f13d4bb
[I 2025-06-15 15:26:30.581 ServerApp] Connecting to kernel a9383ec0-73c0-44ba-be4b-55a14f13d4bb.
[I 2025-06-15 15:26:30.590 ServerApp] Connecting to kernel a9383ec0-73c0-44ba-be4b-55a14f13d4bb.
[W 2025-06-15 15:26:30.607 ServerApp] The websocket_ping_timeout (90000) cannot be longer than the websocket_ping_interval (30000).
Setting websocket_ping_timeout=30000
[I 2025-06-15 15:26:30.612 ServerApp] Connecting to kernel a9383ec0-73c0-44ba-be4b-55a14f13d4bb.

‘’’