I am trying to debug some issues with the extension I am working on where I can compile the extension on my working machine but if I download a fresh copy from my repo I cannot compile the extension.
It seems to be an issue with the type of the Jupyter Menu class but I am unsure why I am seeing these errors only on the downloaded version and not the version of the code I am actively working on.
The exact error I am seeing is below:
src/shortcuts.ts:132:32 - error TS2739: Type 'CommandRegistry' is missing the following properties from type 'CommandRegistry': processKeyupEvent, _startModifierTimer, _clearModifierTimer, _timerModifierID
132 const menuTop = new Menu({ commands: app.commands }); // create menu-bar menu
~~~~~~~~
I tried looking at git status
on my working code and the only file not being tracked is .yarnrc.yml
. I tried adding this file to the repo but got another error. The file contents are here:
>> cat .yarnrc.yml
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-3.5.0.cjs
And the error when adding .yarnrc.yml
is:
>> jlpm
Internal Error: The "yarn-path" option has been set (in /Users/jasonnagy/Container/workspace-lab/remote/unicodelab-ts/.yarnrc.yml), but the specified location doesn't exist (/Users/jasonnagy/Container/workspace-lab/remote/unicodelab-ts/.yarn/releases/yarn-3.5.0.cjs).
at i (/Users/jasonnagy/opt/anaconda3/envs/jlab4/lib/python3.12/site-packages/jupyterlab/staging/yarn.js:446:11180)
at async t (/Users/jasonnagy/opt/anaconda3/envs/jlab4/lib/python3.12/site-packages/jupyterlab/staging/yarn.js:446:10283)
My code is available on gitlab on the package_fix
branch.
1 Like
Type ‘CommandRegistry’ is missing the following properties from type ‘CommandRegistry’: processKeyupEvent, _startModifierTimer, _clearModifierTimer, _timerModifierID
This indicates that you have incompatible versions of the package @lumino/widget
with the package that provides the application (app
) as it depends on different version of @lumino/commands
than @lumino/widget
.
It looks like you are set the dependency in package json to the latest version of "@lumino/widgets": "^2.5.0"
but your lock file includes two versions: 2.3.2:
and 2.5.0:
And you also have two versions of @lumino/commands
.
See the note in Develop Extensions — JupyterLab 4.3.0rc0 documentation
the Lumino widgets system on which JupyterLab relies for communication across the application requires all packages use the same copy of the @lumino/widgets
package
You may be able to solve this by running:
jlpm dlx yarn-berry-deduplicate
This is only documented in Extension Migration Guide — JupyterLab 4.3.0rc0 documentation so we probably should move this to a more prominent location.
1 Like
Thank you for the explanation.
The version of yarn I have been using is jlpm 1.21.1
and it is my understanding that jlpm
is a pinned version of yarn. When I ran the deduplication command you gave me, I got an error saying I need to upgrade yarn. Can I upgrade and subsequently use yarn
in all my commands if I started with jlpm
? Or should I try to upgrade jlpm
? I’m just not sure how yarn
and jlpm
will interact if I try to upgrade and use yarn
after using jlpm
.
Are you developing against JupyterLab 3.x? JupyterLab 4.x comes with jlpm --version
3.5.0
. If you did not intend to develop against JupyterLab 3.x then you can simply update jupyterlab
package and it will update jlpm
for you. If you did want to develop against JupyterLab 3.x, then you will not be able to use many of the @lumino
package from 2.x line either way as JupyterLab 3 uses 1.x line.
By the way, JupyterLab 3.x is no longer receiving bug fixes and will only receive critical security fixes for two more months (until the end of the year).
1 Like
I am developing for Jupyterlab 4. Im not sure why I have a lower version as I made a new conda env for development earlier this year as I would have assumed it would pick up on any changes like that.
Is the jupyterlab
package updated through npm/yarn/jlpm or something else?
1 Like
Is the jupyterlab
package updated through npm/yarn/jlpm or something else?
I was referring to pip
/conda
jupyterlab
package. You can try debugging by checking which jlpm
and which -a jlpm
(if using a Linux/Unix with compatible version of which
).
1 Like