首页 > 解决方案 > Jupyter Labs:构建时出现“RuntimeError: npm dependencies failed to install”

问题描述

我是使用 Anaconda 的新手,最近在我的计算机上安装了 jupyter labs。但是,每当我尝试在本地 Jupyter Labs 实例上构建时,都会收到以下错误:

在 jupyter labs 终端中运行的代码:

PS C:\Users\briakeit> jupyter lab build

输出:

[LabBuildApp] JupyterLab 1.2.5
[LabBuildApp] Building in C:\Users\briakeit\AnacondaFiles\share\jupyter\lab
[LabBuildApp] Building jupyterlab assets (build:prod:minimize)
An error occured.
RuntimeError: npm dependencies failed to install
See the log file for details:  C:\Users\briakeit\AppData\Local\Temp\jupyterlab-debug-0b5ejkfm.log

日志文件:

[LabBuildApp] Building in C:\Users\briakeit\AnacondaFiles\share\jupyter\lab
[LabBuildApp] Yarn configuration loaded.
[LabBuildApp] Node v13.7.0

[LabBuildApp] Building jupyterlab assets (build:prod:minimize)
[LabBuildApp] > node C:\Users\briakeit\AnacondaFiles\lib\site-packages\jupyterlab\staging\yarn.js install --non-interactive
[LabBuildApp] yarn install v1.15.2
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.yarnpkg.com/@jupyterlab/application-extension/-/application-extension-1.2.1.tgz: read ECONNRESET".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\briakeit\\AnacondaFiles\\share\\jupyter\\lab\\staging\\yarn-error.log".
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 "C:\Users\briakeit\AnacondaFiles\lib\site-packages\jupyterlab\debuglog.py", line 47, in debug_logging
    yield

[LabBuildApp]   File "C:\Users\briakeit\AnacondaFiles\lib\site-packages\jupyterlab\labapp.py", line 98, in start
    command=command, app_options=app_options)

[LabBuildApp]   File "C:\Users\briakeit\AnacondaFiles\lib\site-packages\jupyterlab\commands.py", line 459, in build
    command=command, clean_staging=clean_staging)

[LabBuildApp]   File "C:\Users\briakeit\AnacondaFiles\lib\site-packages\jupyterlab\commands.py", line 660, in build
    raise RuntimeError(msg)

[LabBuildApp] RuntimeError: npm dependencies failed to install

[LabBuildApp] Exiting application: JupyterLab

每当我尝试使用此命令时都会发生这种情况(例如,在安装新扩展之后)。根据 conda,我在此环境中安装了 npm v6.4.1、nodejs v10.13.0 和 yarn v1.22.0。我正在运行 Jupyter 实验室 1.2.6。

任何反馈、建议或帮助将不胜感激。

标签: jupyterjupyter-lab

解决方案


我相信我找到了问题所在。我为一家公司咨询,我正在使用他们提供给我的计算机(我是计算机上的管理员)。当我在我的个人计算机上按照相同的步骤操作时,它没有任何问题。

然后,我在工作中切换到一个不同的、更开放的网络,构建能够顺利完成。很明显,防火墙中有什么东西或者是什么东西阻止了我进行构建。


推荐阅读