Problem re-building JupyterLab on Windows

Hello,

I want to install the Matplotlib extension for JupyterLab but when I install it and run:

 jupyter lab build

I get this error on the npm step:

> jupyter-matplotlib@0.8.2 build:labextension c:\program files\python3\share\jupyter\lab\staging\node_modules\jupyter-matplotlib
> jupyter labextension build .

Please supply at least one subcommand: check, disable, enable, install, link, list, uninstall, unlink, update
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! jupyter-matplotlib@0.8.2 build:labextension: `jupyter labextension build .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the jupyter-matplotlib@0.8.2 build:labextension script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Is this JupyterLab 2? Please see the instructions for installing in JupyterLab 2: GitHub - matplotlib/ipympl: Matplotlib Jupyter Integration

You need to install a specific version to work with jlab 1 or 2.

I am new to the whole CLI world, but I just wanted to provide one of the possible solutions as I struggled with the same problem.

For me this worked:

conda install -c conda-forge nodejs
jupyter labextension install @jupyter-widgets/jupyterlab-manager jupyter-plotly
jupyter lab build

So in your case you’d replace plotly with matplotlib.

For a bit of back story, I was notified by JupyterLab a few weeks ago that it is recommended I run jupyter lab build. I ran this code but kept on running into the same error message: npm dependencies failed to install. I tried different methods I found through various forums but I could not figure it out. This time I tried using plotly.express in JupyterLab and the same error message popped up. Surfing through online community I found this GitHub page and found it quite useful.

I have JupyterLab 2.2.6.

Hope this is helpful.