问题描述
这是为了帮助那些面临类似问题的人.尝试安装jupyterlab-plotly扩展程序时,我的构建失败.我的Jupyter Lab版本是1.2.6版.日志如下:
This is to help those who face a similar issue. My builds were failing when trying to install the jupyterlab-plotly extension. My Jupyter Lab version is Version 1.2.6. The log was as follows:
[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 > [email protected]: use String.prototype.padStart()
warning jupyterlab-plotly > plotly.js > point-cluster > bubleify > buble > [email protected]: This is not needed anymore. Use `require('os').homedir()` instead.
[3/5] Fetching packages...
error [email protected]: 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
已过时.
The issue, as indicated by the log file, seemed to be that the node
in my anaconda environment was outdated.
$ type node
node is hashed (/home/***/anaconda3/bin/node)
$ node --version
v6.13.1
查看我机器上的nodejs:
Looking at the nodejs on my machine:
$ type nodejs
nodejs is hashed (/usr/bin/nodejs)
$ nodejs --version
v10.15.2
要解决此问题,我做了以下事情:
To get around this issue I did the following:
- 导航到
node
的父目录 - 以防万一,备份了
node
- 对
nodejs
进行符号链接,在此将其命名为节点" - 运行版本
- 启用了
jupyterlab-plotly
扩展名 - 重新启动Jupyter Lab服务器
- Navigated to
node
's parent directory - Made a backup of
node
just in case - Made a symlink to
nodejs
here named as "node" - Ran the build
- Enabled the
jupyterlab-plotly
extension - Restarted the Jupyter Lab server
命令如下:
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
一段时间后,构建成功结束.
After some time, the build concluded successfully.
我从内置扩展管理器中启用了jupyterlab-plotly
扩展.然后我重新启动了服务器.
I enabled the jupyterlab-plotly
extension from the inbuild extension manager. And I restarted the server.
此后,我的漂亮情节开始按预期渲染. :)希望这可以节省您一些时间.
My pretty plots started rendering as intended after this. :) Hope this saves you some time.
注意:将***替换为计算机上的路径
Note: replace *** with the paths on your machine
这篇关于jupyterlab-plotly构建npm扩展无法在Linux上安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!