Skip to content

Missing definition file require.js while trying to use thebe-core in a JupyterLab extension  #761

@nthiery

Description

@nthiery

I am trying to use thebe-core in a JupyterLab extension. To this end, I used:

jlpm add thebe-core

However, in subsequent builds of my extension, I get these errors:

jlpm build            
node_modules/thebe-core/dist/types/requireJsLoader.d.ts:4:23 - error TS2688: Cannot find type definition file for 'requirejs'.

4 /// <reference types="requirejs" />
                        ~~~~~~~~~

node_modules/thebe-core/dist/types/requireJsLoader.d.ts:6:23 - error TS2552: Cannot find name 'Require'. Did you mean 'Required'?

6     readonly require: Require;
                        ~~~~~~~

node_modules/thebe-core/dist/types/requireJsLoader.d.ts:7:22 - error TS2304: Cannot find name 'RequireDefine'.

7     readonly define: RequireDefine;
                       ~~~~~~~~~~~~~

node_modules/thebe-core/dist/types/requireJsLoader.d.ts:16:33 - error TS2552: Cannot find name 'Require'. Did you mean 'Required'?

16     load(postLoadFn?: (require: Require, define: RequireDefine) => Promise<void> | void): Promise<IRequireJS>;
                                   ~~~~~~~

node_modules/thebe-core/dist/types/requireJsLoader.d.ts:16:50 - error TS2304: Cannot find name 'RequireDefine'.

16     load(postLoadFn?: (require: Require, define: RequireDefine) => Promise<void> | void): Promise<IRequireJS>;
                                                    ~~~~~~~~~~~~~

node_modules/thebe-core/dist/types/server.d.ts:4:39 - error TS2307: Cannot find module 'thebe-lite' or its corresponding type declarations.

4 import type { LiteServerConfig } from 'thebe-lite';
                                        ~~~~~~~~~~~~

node_modules/thebe-core/dist/types/thebe/entrypoint.d.ts:12:38 - error TS2307: Cannot find module 'thebe-lite' or its corresponding type declarations.

12 import type { ThebeLiteGlobal } from 'thebe-lite';
                                        ~~~~~~~~~~~~


Found 7 errors in 3 files.

Errors  Files
     5  node_modules/thebe-core/dist/types/requireJsLoader.d.ts:4
     1  node_modules/thebe-core/dist/types/server.d.ts:4
     1  node_modules/thebe-core/dist/types/thebe/entrypoint.d.ts:12

Any suggestions?

The thebe-lite error was easy to fix by forcing jlpm add thebe-lite, though I would have expected this to be automatic with the dependency on thebe-lite written in thebe-core/.../package.json.

For information: I tried installing from a local clone of the development version of thebe by doing jlpm add /opt/thebe/packages/core; but I probably did that wrong since I get:

jlpm run build                              
src/index.ts:21:37 - error TS2307: Cannot find module 'thebe-core' or its corresponding type declarations.

21 import { PassiveCellRenderer } from 'thebe-core';

I have tried various things like cleaning up the cache, redoing a fresh install, ... However I am beginner in Javascript development and may well have screwed stupid things ... sorry :-)

Help appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions