Seeker
Seeker

Reputation: 327

Custom jupyter labextension fails to install

We have a custom jupyterlab extension that fails to install for nodejs=14.14.0 (and for 15.2.1) (installed using conda).

Here's how the package.json file looks like for the labextension:

{
    "name": "my-custom-ext",
    "version": "0.1.0",
    "description": "Integrate JupyterLab with ext",
    "keywords": [
        "jupyter",
        "jupyterlab",
        "jupyterlab-extension"
    ],
    "homepage": "https://github.com/my_name/myextension",
    "bugs": {
        "url": "https://github.com/my_name/myextension/issues"
    },
    "license": "BSD-3-Clause",
    "author": "xyz",
    "files": [
        "lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
        "style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}"
    ],
    "main": "lib/index.js",
    "types": "lib/index.d.ts",
    "repository": {
        "type": "git",
        "url": "https://github.com/my_name/myextension.git"
    },
    "scripts": {
        "build": "tsc",
        "clean": "rimraf lib",
        "prepare": "npm run clean && npm run build",
        "watch": "tsc -w"
    },
    "dependencies": {
        "@jupyterlab/application": "^3.0.6",
        "@jupyterlab/apputils": "^3.0.5",
        "@jupyterlab/coreutils": "^5.0.3",
        "@jupyterlab/docregistry": "^3.0.6",
        "@jupyterlab/launcher": "^3.0.5",
        "@jupyterlab/mainmenu": "^3.0.5",
        "@jupyterlab/notebook": "^3.0.6",
        "@jupyterlab/services": "^6.0.5",
        "@lumino/commands": "^1.12.0",
        "@lumino/coreutils": "^1.5.3",
        "@lumino/disposable": "^1.4.3",
        "@lumino/widgets": "^1.16.1"
   
    },
    "devDependencies": {
        "@jupyterlab/builder": "^3.0.0",
        "rimraf": "^3.0.2",
        "typescript": "~4.1.3"
    },
    "jupyterlab": {
        "extension": true
    }
}

Here's the error jupyter labextension install --no-build my-custom-ext :

Node v14.14.0

Yarn configuration loaded.
> node /opt/conda/lib/python3.8/site-packages/jupyterlab/staging/yarn.js install
-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-yarn install v1.21.1
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
warning @blueprintjs/[email protected]: Invalid bin entry for "upgrade-blueprint-2.0.0-rename" (in "@blueprintjs/core").
warning @blueprintjs/[email protected]: Invalid bin entry for "upgrade-blueprint-3.0.0-rename" (in "@blueprintjs/core").
error @npmcli/[email protected]: The engine "node" is incompatible with this module. Expected version "^12.13.0 || ^14.15.0 || >=16". Got "14.14.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

> /opt/conda/bin/npm pack /home/jovyan/my-custom-ext

-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-
> [email protected] prepare /home/jovyan/my-custom-ext
> npm run clean && npm run build


> [email protected] clean /home/jovyan/my-custom-ext
> rimraf lib


> [email protected] build /home/jovyan/my-custom-ext
> tsc

src/index.ts(1,72): error TS2307: Cannot find module '@jupyterlab/apputils' or its corresponding type declarations.
....
....
....
ValueError: "/home/jovyan/my-custom-ext" is not a valid npm package

Exiting application: lab

Running "npm ls" I got :

├─┬ @jupyterlab/[email protected]
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├─┬ @npmcli/[email protected]

changed package.json to :

"devDependencies": {
        "@jupyterlab/builder": "=3.2.4",......

But that didnt help. Still got the same error

Note : https://www.npmjs.com/package/@npmcli/fs :1.1.0 was published 5 days ago.

Please help how to fix

Upvotes: 1

Views: 1694

Answers (1)

krassowski
krassowski

Reputation: 15409

This fragment is relevant:

Expected version "^12.13.0 || ^14.15.0 || >=16". Got "14.14.0"

It tells you that you need to use node 14.15.0 or newer 14.x and that you cannot use 13.x, 15.x. But you have 14.14.0 - this means that you need to upgrade your node.js.

You mention conda - it might be that you use outdated default channels and therefore you get the old minor release of 14.x; conda-forge channel has all the versions and I recommend switching to it. If you already use conda-forge and cannot get the newer version, you may want to try using mamba as it has a better dependency resolver.

Note: 15.x and newer is not well supported by JupyterLab 3.x at the moment anyways (among other because not all dependencies upgraded to 16.x yet as Node follow odd-even version cadence where only even numbers are stable long enough for the wider ecosystem to have incentive to migrate).

Upvotes: 1

Related Questions