npm - jupyterlab-plotly 构建 npm 扩展在 Linux 上安装失败

标签 npm plotly jupyter-lab plotly-python

这是为了帮助那些面临类似问题的人。尝试安装 jupyterlab-plotly 扩展时,我的构建失败了。我的 Jupyter Lab 版本是 1.2.6 版。日志如下:

[LabBuildApp] Building in /home/***/anaconda3/share/jupyter/lab
[LabBuildApp] Yarn configuration loaded.
[LabBuildApp] Node v6.13.1

[LabBuildApp] Building jupyterlab assets (build:prod:minimize)
[LabBuildApp] > node /home/***/anaconda3/lib/python3.7/site-packages/jupyterlab/staging/yarn.js install --non-interactive
[LabBuildApp] yarn install v1.15.2
[1/5] Validating package.json...
[2/5] Resolving packages...
warning jupyterlab-plotly > plotly.js > regl-splom > left-pad@1.3.0: use String.prototype.padStart()
warning jupyterlab-plotly > plotly.js > point-cluster > bubleify > buble > os-homedir@2.0.0: This is not needed anymore. Use `require('os').homedir()` instead.
[3/5] Fetching packages...
error ws@7.2.1: The engine "node" is incompatible with this module. Expected version ">=8.3.0". Got "6.13.1"
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

[LabBuildApp] npm dependencies failed to install
[LabBuildApp] Traceback (most recent call last):

[LabBuildApp]   File "/home/***/anaconda3/lib/python3.7/site-packages/jupyterlab/debuglog.py", line 47, in debug_logging
    yield

[LabBuildApp]   File "/home/***/anaconda3/lib/python3.7/site-packages/jupyterlab/labapp.py", line 98, in start
    command=command, app_options=app_options)

[LabBuildApp]   File "/home/***/anaconda3/lib/python3.7/site-packages/jupyterlab/commands.py", line 459, in build
    command=command, clean_staging=clean_staging)

[LabBuildApp]   File "/home/***/anaconda3/lib/python3.7/site-packages/jupyterlab/commands.py", line 660, in build
    raise RuntimeError(msg)

[LabBuildApp] RuntimeError: npm dependencies failed to install

[LabBuildApp] Exiting application: JupyterLab
~                                                                                                                                                     
~                                                                                                                                                     
"/tmp/jupyterlab-debug-7x6sz5zm.log" 34L, 1758C

答案在于答案

最佳答案

如日志文件所示,问题似乎是我的 anaconda 环境中的 node 已过时。

$ type node
node is hashed (/home/***/anaconda3/bin/node)

$ node --version
v6.13.1

查看我机器上的 nodejs:

$ type nodejs
nodejs is hashed (/usr/bin/nodejs)

$ nodejs --version
v10.15.2

为了解决这个问题,我做了以下事情:

  1. 导航到节点的父目录
  2. 备份节点以防万一
  3. 创建了一个指向 nodejs 的符号链接(symbolic link),这里命名为“node”
  4. 运行构建
  5. 启用jupyterlab-plotly 扩展
  6. 重新启动 Jupyter Lab 服务器

命令如下:

cd /home/***/anaconda3/bin/
cp node node_bak
rm node
sudo ln -s /usr/bin/nodejs /home/***/anaconda3/bin/node
jupyter lab clean
jupyter lab build

一段时间后,构建成功结束。

我从内置扩展管理器中启用了 jupyterlab-plotly 扩展。然后我重新启动了服务器。

在此之后,我的漂亮图开始按预期呈现。 :) 希望这能为您节省一些时间。

注意:用你机器上的路径替换***

关于npm - jupyterlab-plotly 构建 npm 扩展在 Linux 上安装失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61210272/

相关文章:

javascript - 如何在 Nexus 中创建 token (用于私有(private)包)?无法通过其 UI 创建 token

reactjs - npm postinstall 仅在未安装任何内容时运行

r - 使用第三个变量添加大小和颜色以使用plotly进行绘图

python - 如何在 plotly 中的子图上绘制矩形?

python - 命令 "jupyter lab"不起作用,因为文件不存在

javascript - ES6 使用不带路径的模块名称导入

performance - 加快 Node 模块的许多安装速度

r - 在绘图中切换跟踪时,没有动态更新轴范围(关闭轴自动缩放)?

python - 如何添加到jupyter lab中的pythonpath

python - Jupyter 实验室中的后台线程时钟