Node.js JupyterLab plotly扩展错误:找不到模块jupyter\lab\staging\node\u modules\ejs\postinstall.js
我正在尝试安装JupyterLab渲染器支持,以便使用:Node.js JupyterLab plotly扩展错误:找不到模块jupyter\lab\staging\node\u modules\ejs\postinstall.js,node.js,npm,plotly,ejs,jupyter-lab,Node.js,Npm,Plotly,Ejs,Jupyter Lab,我正在尝试安装JupyterLab渲染器支持,以便使用: jupyter labextension install jupyterlab-plotly@4.10.0 我得到 运行时错误:npm依赖项安装失败 日志文件包含以下内容: [LabBuildApp] Building in C:\Users\<user>\anaconda3\share\jupyter\lab [LabBuildApp] Node v14.11.0 [LabBuildApp] Yarn configura
jupyter labextension install jupyterlab-plotly@4.10.0
我得到
运行时错误:npm依赖项安装失败
日志文件包含以下内容:
[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
在我尝试之后,我在日志文件中得到了相同的错误
我使用的是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
及
对于http
或
对于
https
好的,我想知道为什么会发生这种情况了,ejs
的第2版有一个安装后脚本,但它已从第3版中删除。看起来另一个包cjs
出于某种原因试图直接调用ejs/postInstall.js
看起来你有一些不同步的依赖项。我的建议是删除node\u模块
和package lock.json
,然后重试install命令
如果这不起作用,请查找任何其他锁定文件,例如warn.lock
,然后删除它们,然后再次删除node\u模块
祝您好运从您之前的评论中,您确认您没有支持任何代理,这是导致这些错误的最常见原因之一。即使我尝试安装jupyter实验室和plotly扩展,因为我也想尝试一下,它对我来说没有任何错误
这个问题在您的环境中可能非常具体。主要是因为npm包的损坏。你可以尝试下面的任何一个步骤,它可能会成功
移动到目录C:\Users\anaconda3\share\jupyter\lab\staging
,并删除node\u module
文件夹。删除文件夹后,请尝试从同一文件夹运行命令warn install
。如果没有错误,那么你应该是好的
如果上述操作不起作用,您可以使用命令warn cache clean
重置纱线缓存。然后重试步骤1
如果仍然不起作用,请尝试删除warn.lock
文件,然后执行步骤2和1
节点:请备份要删除的文件。此外,也无法判断哪一步对您有效,它只是点击并试用。如果您尝试自行安装ejs会发生什么情况$npm install ejs
?我得到了同样的结果,似乎您必须将其安装到现有的project@DavidBradshaw你能解释一下你的意思吗?我的意思是你只能在一个现有的节点项目中运行npm install ejs,该项目中有一个package.json文件。你支持任何类型的代理吗???我不支持代理。已关闭严格的ssl,但未进行任何更改:(很抱歉,它没有帮助..我将尝试了解其他选项。如果这些都不起作用,请尝试从节点\u模块中删除ejs
,然后安装ejs@2.7
我从C:\users\中删除了node_模块和package-lock.json,并运行了npm install ejs。然后尝试安装jupyterlab扩展,但又出现了同样的错误最后,我删除了ejs并运行了npm安装ejs@2.7.我再次遇到相同的错误。您需要在C:\Users\\anaconda3\share\jupyter\lab\staging\n中执行此操作。我尝试了1和2,得到一个标题为:Windows脚本主机:Script C:\Users\\anaconda3\share\jupyter\lab\staging\Thread.js的弹出窗口。行:1,字符:1,错误:无效字符字符,代码800A03F6,源代码:Microsoft JScript编译错误。我也尝试了步骤3,但得到了相同的错误。请注意,Thread.js的第一行包含:#!/usr/bin/env nodeI决定删除Thread.js,然后通过重新安装。然后我重试了步骤2和步骤1。没有错误,继续进行jupyter labextension安装jupyterlab@4.10.0.它的效果非常好!非常感谢!
npm config set strict-ssl false
npm config set proxy http://host:port
npm config set https-proxy https://host:port