`jlab` command launches Node.js shell instead of JupyterLab Desktop

When I run jlab to launch JupyterLab Desktop from the command line, it opens a Node.js shell instead (see screenshot below). The command seems to point to the correct path for JupyterLab Desktop (see screenshot below), and after uninstalling the app the command is no longer recognised, so I’m pretty confident I don’t have another programme trying to use the same command. This started after updating JupyterLab Desktop after a period of several months without using it, so not sure if this is happening only in the newest version. Has anyone else encountered this issue or does anyone have any suggestions on how to solve it?

Running JupyterLab Desktop v3.5.0-1 on Linux Mint 20.3 (kernel 5.15).

image

you should add a directory after jlab. for ex jlab .

Thanks for the suggestion, but I have tried that and I get the same result.

Could you try with v3.5.1-1? This was a substantial rewrite.

Thanks for that. I have updated and ensured that JupyterLab Desktop opens correctly from the GUI’s Start Menu. In the command line, I now get the following:

  1. With just jlab, same as before.
  2. With jlab . I get:
node:internal/modules/cjs/loader:966
  throw err;
  ^

Error: Cannot find module 'path/to/current/directory'
    at Module._resolveFilename (node:internal/modules/cjs/loader:963:15)
    at Module._load (node:internal/modules/cjs/loader:811:27)
    at f._load (node:electron/js2c/asar_bundle:2:13328)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
  1. With jlab file.ipynb I get:
full/path/to/file.ipynb:2
 "cells": [
        ^

SyntaxError: Unexpected token ':'
    at Object.compileFunction (node:vm:360:18)
    at wrapSafe (node:internal/modules/cjs/loader:1062:15)
    at Module._compile (node:internal/modules/cjs/loader:1097:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1196:10)
    at Module.load (node:internal/modules/cjs/loader:1011:32)
    at Module._load (node:internal/modules/cjs/loader:846:12)
    at f._load (node:electron/js2c/asar_bundle:2:13328)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47

Any ideas?

Sorry, I don’t have any good ideas. Did you try erasing the old installation manually and installing afresh? My suspicion is that when upgrading some files did not get cleaned up and are interfering.

Some things you could check:

  1. is /usr/bin/jlab a symlink? ls -l /usr/bin/jlab should show what it resolves to; for me it is /usr/bin/jlab -> /opt/JupyterLab/resources/app/jlab
  2. are the contents of /usr/bin/jlab up to date? for me it is:
    #!/usr/bin/env sh
    
    # calculate application path from this script's path
    SELF_DIR=$(dirname $(realpath $0))
    JLAB_PATH=$(realpath "$SELF_DIR"/../../jupyterlab-desktop)
    $JLAB_PATH "$@"
    exit $?
    
  3. What is the result of which node and node --version? These should not interfere with electron but let’s see.

Maybe it’s worth opening an issue on Issues · jupyterlab/jupyterlab-desktop · GitHub ?

I purged the old installation before installing the new version.

For suggestions 1 and 2 I get the same as you describe.

For suggestion 3 I get the response that node.js isn’t installed (though if I run jlab without a directory/file path I still get a node.js shell :thinking:). So I tried installing node.js, but it hasn’t made a difference to the issue described above. For the record:

$ which node
/usr/bin/node
$ node --version
v10.19.0

I think you’re right, I’ll open an issue for this. Thanks again for taking the time to help me :slight_smile:

1 Like

node version should be > 12 i suggest 16 or 18 lts, and create conda env install node there and then install waht you need then try

I have tried creating a new conda env with node v18 and launching jlab from there, but I still get the same responses as described above.