No provider for @jupyterlab/notebook:INotebookTracker

I am trying to develop a jupyterlab widget and am having issues importing the notebooktracker into my extension. My goal is to import this package so that i can add new cells to the notebook from my widget. My widget builds fine without the INotebookTracker, however when I specify it as required it fails to activate.

Error in console

Plugin 'diginlineprofiler:plugin' failed to activate.
Error: No provider for: @jupyterlab/notebook:INotebookTracker.

My plugin.ts

Note this works fine until I import INotebookTracker


import type {
  JupyterFrontEnd,
  JupyterFrontEndPlugin
} from '@jupyterlab/application';

import { IJupyterWidgetRegistry } from '@jupyter-widgets/base';
import * as widgetExports from './widget';
import { MODULE_NAME, MODULE_VERSION } from './version';
import { INotebookTracker } from '@jupyterlab/notebook';

const EXTENSION_ID = 'myplugin:plugin';

const extension: JupyterFrontEndPlugin<void> = {
  id: EXTENSION_ID,
  requires: [IJupyterWidgetRegistry, INotebookTracker],
  activate: (app: JupyterFrontEnd, registry: IJupyterWidgetRegistry, nbtracker: INotebookTracker) => {

    registry.registerWidget({
      name: MODULE_NAME,
      version: MODULE_VERSION,
      exports: widgetExports,
    });

  },
  autoStart: true,
};

export default extension;

my package.json

{
    "dependencies": {
        "@jupyter-widgets/base": "^1.1 || ^2 || ^3 || ^4 || ^6",
        "@jupyterlab/application": "^3.4.8",
        "@jupyterlab/notebook": "^3.4.8"
    },
    "devDependencies": {
        "@jupyterlab/builder": "^3.0.0",
    },
     "jupyterlab": {
    "extension": "lib/index",
    "outputDir": "diginlineprofiler/labextension/",
    "sharedPackages": {
      "@jupyter-widgets/base": {
        "bundled": false,
        "singleton": true
      },
      "@jupyterlab/notebook": {
        "bundled": false,
        "singleton": true
      }
    }
  },
}

My python jupyter lab is v3.6.1, I have @jupyter-widgets/jupyterlab-manager v5.0.5, and ipywidgets 8.0.4. I suspect this might be some kind of version issue but I am struggling to figure out what is off or how to debug further.

Still not sure how to resolve this issue, but I found a workaround to use a python library to add code cells to notebooks and am just syncing the two with traitlets so is working for me now if others are trying to do the same thing of adding code cells to notebooks

This thread has more discussion: