JupyterLab plotly extension error: Cannot find module jupyter\lab\staging\node_modules\ejs\postinstall.js
JupyterLab plotly extension error: Cannot find module jupyter\lab\staging\node_modules\ejs\postinstall.js
我正在尝试安装对 Plotly 的 JupyterLab 渲染器支持:
jupyter labextension install jupyterlab-plotly@4.10.0
我得到
RuntimeError: npm dependencies failed to install
日志文件包含以下内容:
[LabBuildApp] Building in C:\Users\<user>\anaconda3\share\jupyter\lab
[LabBuildApp] Node v14.11.0
[LabBuildApp] Yarn configuration loaded.
[LabBuildApp] Building jupyterlab assets (build:prod:minimize)
[LabBuildApp] > node C:\Users\<user>\anaconda3\lib\site-packages\jupyterlab\staging\yarn.js install --non-interactive
[LabBuildApp] yarn install v1.21.1
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
info fsevents@2.1.3: The platform "win32" is incompatible with this module.
info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.13: The platform "win32" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning " > @lumino/coreutils@1.5.0" has unmet peer dependency "crypto@1.0.1".
[5/5] Building fresh packages...
error C:\Users\<user>\anaconda3\share\jupyter\lab\staging\node_modules\ejs: Command failed.
Exit code: 1
Command: node ./postinstall.js
Arguments:
Directory: C:\Users\<user>\anaconda3\share\jupyter\lab\staging\node_modules\ejs
Output:
internal/modules/cjs/loader.js:896
throw err;
^
Error: Cannot find module 'C:\Users\<user>\anaconda3\share\jupyter\lab\staging\node_modules\ejs\postinstall.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:893:15)
at Function.Module._load (internal/modules/cjs/loader.js:743:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
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\<user>\anaconda3\lib\site-packages\jupyterlab\debuglog.py", line 47, in debug_logging
yield
[LabBuildApp] File "C:\Users\<user>\anaconda3\lib\site-packages\jupyterlab\labapp.py", line 138, in start
raise e
[LabBuildApp] File "C:\Users\<user>\anaconda3\lib\site-packages\jupyterlab\labapp.py", line 134, in start
build(name=self.name, version=self.version,
[LabBuildApp] File "C:\Users\<user>\anaconda3\lib\site-packages\jupyterlab\commands.py", line 459, in build
return handler.build(name=name, version=version, static_url=static_url,
[LabBuildApp] File "C:\Users\<user>\anaconda3\lib\site-packages\jupyterlab\commands.py", line 652, in build
raise RuntimeError(msg)
[LabBuildApp] RuntimeError: npm dependencies failed to install
[LabBuildApp] Exiting application: JupyterLab
当我打开 JupyterLab 时,我被要求做一个
jupyter lab build
在我尝试之后,我在日志文件中得到了同样的错误。
我正在使用 Windows10、node.js 14.11.0(使用 conda 安装)、JupyterLab 2.1.5
注意我试过了:
- 正在卸载 conda 的 node.js 并直接从 node-v12.18.3-x64.msi
安装 node.js
- 卸载和安装 Anaconda
都没有运气。
可能是防火墙的问题。
尝试在 npm
的配置中设置代理,甚至关闭 strict-ssl
:
npm config set strict-ssl false
和
npm config set proxy http://host:port
对于http
或
npm config set https-proxy https://host:port
对于https
好的,我想明白为什么会这样了,ejs
的第 2 版有一个 post 安装脚本,但它已从第 3 版中删除。它看起来像另一个包 cjs
出于某种原因试图直接调用 ejs/postInstall.js
。
您似乎有一些依赖项不同步。我的建议是删除 node_modules
和 package-lock.json
并再次尝试安装命令。
如果这不起作用,请查找任何其他锁定文件,例如 yarn.lock
并删除它们,然后再次 node_modules
。
祝你好运
根据您之前的评论,您确认您没有使用任何代理,这是导致这些错误的最常见原因之一。即使我尝试安装 jupyter lab 和 plotly 扩展,因为我也想尝试一下,它对我没有任何错误。
问题可能因您的环境而异。主要是因为损坏的 npm 包。您可以尝试以下任何步骤,它可能会成功
移动到目录 C:\Users\anaconda3\share\jupyter\lab\staging
,并删除 node_module
文件夹。删除文件夹后,请从同一文件夹尝试 运行 命令 yarn install
。如果没有错误那么你应该是好的。
如果上述方法不起作用,您可以使用命令yarn cache clean
重置纱线缓存。并重试步骤 1。
如果仍然无效,请尝试删除 yarn.lock
文件,然后执行第 2 步和第 1 步。
节点:请备份您要删除的文件。也没有办法告诉你哪一步适合你,它只是点击和试用。
我正在尝试安装对 Plotly 的 JupyterLab 渲染器支持:
jupyter labextension install jupyterlab-plotly@4.10.0
我得到
RuntimeError: npm dependencies failed to install
日志文件包含以下内容:
[LabBuildApp] Building in C:\Users\<user>\anaconda3\share\jupyter\lab
[LabBuildApp] Node v14.11.0
[LabBuildApp] Yarn configuration loaded.
[LabBuildApp] Building jupyterlab assets (build:prod:minimize)
[LabBuildApp] > node C:\Users\<user>\anaconda3\lib\site-packages\jupyterlab\staging\yarn.js install --non-interactive
[LabBuildApp] yarn install v1.21.1
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
info fsevents@2.1.3: The platform "win32" is incompatible with this module.
info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.13: The platform "win32" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning " > @lumino/coreutils@1.5.0" has unmet peer dependency "crypto@1.0.1".
[5/5] Building fresh packages...
error C:\Users\<user>\anaconda3\share\jupyter\lab\staging\node_modules\ejs: Command failed.
Exit code: 1
Command: node ./postinstall.js
Arguments:
Directory: C:\Users\<user>\anaconda3\share\jupyter\lab\staging\node_modules\ejs
Output:
internal/modules/cjs/loader.js:896
throw err;
^
Error: Cannot find module 'C:\Users\<user>\anaconda3\share\jupyter\lab\staging\node_modules\ejs\postinstall.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:893:15)
at Function.Module._load (internal/modules/cjs/loader.js:743:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
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\<user>\anaconda3\lib\site-packages\jupyterlab\debuglog.py", line 47, in debug_logging
yield
[LabBuildApp] File "C:\Users\<user>\anaconda3\lib\site-packages\jupyterlab\labapp.py", line 138, in start
raise e
[LabBuildApp] File "C:\Users\<user>\anaconda3\lib\site-packages\jupyterlab\labapp.py", line 134, in start
build(name=self.name, version=self.version,
[LabBuildApp] File "C:\Users\<user>\anaconda3\lib\site-packages\jupyterlab\commands.py", line 459, in build
return handler.build(name=name, version=version, static_url=static_url,
[LabBuildApp] File "C:\Users\<user>\anaconda3\lib\site-packages\jupyterlab\commands.py", line 652, in build
raise RuntimeError(msg)
[LabBuildApp] RuntimeError: npm dependencies failed to install
[LabBuildApp] Exiting application: JupyterLab
当我打开 JupyterLab 时,我被要求做一个
jupyter lab build
在我尝试之后,我在日志文件中得到了同样的错误。
我正在使用 Windows10、node.js 14.11.0(使用 conda 安装)、JupyterLab 2.1.5
注意我试过了:
- 正在卸载 conda 的 node.js 并直接从 node-v12.18.3-x64.msi 安装 node.js
- 卸载和安装 Anaconda
都没有运气。
可能是防火墙的问题。
尝试在 npm
的配置中设置代理,甚至关闭 strict-ssl
:
npm config set strict-ssl false
和
npm config set proxy http://host:port
对于http
或
npm config set https-proxy https://host:port
对于https
好的,我想明白为什么会这样了,ejs
的第 2 版有一个 post 安装脚本,但它已从第 3 版中删除。它看起来像另一个包 cjs
出于某种原因试图直接调用 ejs/postInstall.js
。
您似乎有一些依赖项不同步。我的建议是删除 node_modules
和 package-lock.json
并再次尝试安装命令。
如果这不起作用,请查找任何其他锁定文件,例如 yarn.lock
并删除它们,然后再次 node_modules
。
祝你好运
根据您之前的评论,您确认您没有使用任何代理,这是导致这些错误的最常见原因之一。即使我尝试安装 jupyter lab 和 plotly 扩展,因为我也想尝试一下,它对我没有任何错误。
问题可能因您的环境而异。主要是因为损坏的 npm 包。您可以尝试以下任何步骤,它可能会成功
移动到目录
C:\Users\anaconda3\share\jupyter\lab\staging
,并删除node_module
文件夹。删除文件夹后,请从同一文件夹尝试 运行 命令yarn install
。如果没有错误那么你应该是好的。如果上述方法不起作用,您可以使用命令
yarn cache clean
重置纱线缓存。并重试步骤 1。如果仍然无效,请尝试删除
yarn.lock
文件,然后执行第 2 步和第 1 步。
节点:请备份您要删除的文件。也没有办法告诉你哪一步适合你,它只是点击和试用。