启动 Jupyter Lab 时语言服务器规范查找器错误

olb*_*o11 5 jupyter jupyter-notebook jupyter-lab

我只是想了解下面发生的事情。我正在使用 MacO,最近从 bash 切换到 zsh。然后我安装了 jupyterlab-lsp。你能赐教一下吗?


    [W 14:27:11.102 LabApp] Failed to fetch commands from language server spec finder`bash-language-server`:
        expected str, bytes or os.PathLike object, not tuple
    [W 14:27:11.108 LabApp] Failed to fetch commands from language server spec finder`dockerfile-language-server-nodejs`:
        expected str, bytes or os.PathLike object, not tuple
    [W 14:27:11.113 LabApp] Failed to fetch commands from language server spec finder`javascript-typescript-langserver`:
        expected str, bytes or os.PathLike object, not tuple
    [W 14:27:11.125 LabApp] Failed to fetch commands from language server spec finder`unified-language-server`:
        expected str, bytes or os.PathLike object, not tuple
    [W 14:27:11.129 LabApp] Failed to fetch commands from language server spec finder`vscode-css-languageserver-bin`:
        expected str, bytes or os.PathLike object, not tuple
    [W 14:27:11.133 LabApp] Failed to fetch commands from language server spec finder`vscode-html-languageserver-bin`:
        expected str, bytes or os.PathLike object, not tuple
    [W 14:27:11.138 LabApp] Failed to fetch commands from language server spec finder`vscode-json-languageserver-bin`:
        expected str, bytes or os.PathLike object, not tuple
    [W 14:27:11.142 LabApp] Failed to fetch commands from language server spec finder`yaml-language-server`:
        expected str, bytes or os.PathLike object, not tuple
    [I 14:27:11.193 LabApp] JupyterLab extension loaded from /Users/emilolbinado/anaconda3/lib/python3.6/site-packages/jupyterlab
    [I 14:27:11.193 LabApp] JupyterLab application directory is /Users/emilolbinado/anaconda3/share/jupyter/lab
    [I 14:27:11.195 LabApp] Serving notebooks from local directory: /Users/emilolbinado
    [I 14:27:11.195 LabApp] The Jupyter Notebook is running at:
    [I 14:27:11.195 LabApp] http://localhost:8888/?token=95a48a55a6638a48cbfa24c95106903144ffaafe10a65652
    [I 14:27:11.195 LabApp]  or http://127.0.0.1:8888/?token=95a48a55a6638a48cbfa24c95106903144ffaafe10a65652
    [I 14:27:11.195 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
    [C 14:27:11.202 LabApp] 

        To access the notebook, open this file in a browser:
            file:///Users/emilolbinado/Library/Jupyter/runtime/nbserver-8098-open.html
        Or copy and paste one of these URLs:
            http://localhost:8888/?token=95a48a55a6638a48cbfa24c95106903144ffaafe10a65652
         or http://127.0.0.1:8888/?token=95a48a55a6638a48cbfa24c95106903144ffaafe10a65652
    Opening in existing browser session.
    [I 14:27:14.645 LabApp] Build is up to date
    [I 14:27:21.183 LabApp] Kernel started: 5c355536-12b0-41de-8c81-cc2afef6a85c
    [I 14:27:21.218 LabApp] Kernel started: 9505d56b-0f5a-43f4-970e-990fa0852522

Run Code Online (Sandbox Code Playgroud)

olb*_*o11 3

问题是因为 jupyter 服务器无法找到语言服务器。就我而言,jupyter是使用/opt/miniconda3/下的conda环境(miniconda)安装和维护的,而我的nodejs位于/usr/local/下。理想情况下,如果您已经在使用 conda 管理器,则需要完全卸载 nodejs 并使用 conda 重新安装。否则,删除整个 anaconda/conda,然后使用 pip 或 brew 重新安装 python ( https://www.python.org/downloads/release/python-381/ ) 和 jupyter,具体取决于您安装 Nodejs 的方式/位置。

我能够按照以下步骤解决我的问题:

1.) 完全卸载node js。我可以通过运行来完成此操作nvm uninstall <version>,或者如果您使用的是自制软件,请运行brew uninstall node然后rm -f /usr/local/bin/npm在终端上运行。另外,您可以按照以下参考:How do I完全卸载Node.js,并从头开始重新安装(Mac OS X)

2.) 重新安装nodejs。conda install -c conda-forge nodejs

3.) 安装语言服务器。请参阅参考:https://github.com/krassowski/jupyterlab-lsp/blob/master/LANGUAGESERVERS.md#installing-language-servers

4.) 重新启动终端并运行 jupyter lab。

现在,这是我能够解决我的问题的最佳答案。