JupyterLab 3.0.4 构建错误 [webpack-cli] [31mTypeError: 'compilation' 参数必须是 Compilation 的一个实例

问题描述

当我尝试运行 jupyter lab build 时出现错误。我尝试卸载 jupyterlab 并重新安装它,我还对整个 anaconda 尝试了这种方法。我在 Windows 10 上运行它。这是错误

[LabBuildApp] JupyterLab 3.0.4
[LabBuildApp] Building in c:\users\acrul\anaconda3\share\jupyter\lab
[LabBuildApp] Building jupyterlab assets (production,minimized)
Build Failed.
Troubleshooting: If the build Failed due to an out-of-memory error,you
may be able to fix it by disabling the `dev_build` and/or `minimize` options.

If you are building via the `jupyter lab build` command,you can disable
these options like so:

jupyter lab build --dev-build=False --minimize=False

You can also disable these options for all JupyterLab builds by adding these
lines to a Jupyter config file named `jupyter_config.py`:

c.LabBuildApp.minimize = False
c.LabBuildApp.dev_build = False

If you don't already have a `jupyter_config.py` file,you can create one by
adding a blank file of that name to any of the Jupyter config directories.
The config directories can be listed by running:

jupyter --paths

Explanation:

- `dev-build`: This option controls whether a `dev` or a more streamlined
`production` build is used. This option will default to `False` (i.e.,the
`production` build) for most users. However,if you have any labextensions
installed from local files,this option will instead default to `True`.
Explicitly setting `dev-build` to `False` will ensure that the `production`
build is used in all circumstances.

- `minimize`: This option controls whether your JS bundle is minified
during the Webpack build,which helps to improve JupyterLab's overall
performance. However,the minifier plugin used by Webpack is very memory
intensive,so turning it off may help the build finish successfully in
low-memory environments.

An error occured.
RuntimeError: JupyterLab Failed to build
See the log file for details:  C:\Users\acrul\AppData\Local\Temp\jupyterlab-debug-9xkqhcqu.log

还有日志文件。我假设错误在这里: [webpack-cli] [31mTypeError: 'compilation' 参数必须是 Compilation 的一个实例 在 Function.getCompilationHooks (c:\users\acrul\anaconda3\share\jupyter\lab\staging\node_modules\webpack\lib\javascript\JavascriptModulesPlugin.js:119:10)

[LabBuildApp] Building in c:\users\acrul\anaconda3\share\jupyter\lab
[LabBuildApp] Node v14.15.4

[LabBuildApp] Yarn configuration loaded.
[LabBuildApp] Building jupyterlab assets (production,minimized)
[LabBuildApp] > node c:\users\acrul\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 [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and Failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning "@jupyterlab/extensionmanager > react-paginate@6.5.0" has incorrect peer dependency "react@^16.0.0".
warning "@jupyterlab/json-extension > react-Highlighter@0.4.3" has incorrect peer dependency "react@^0.14.0 || ^15.0.0 || ^16.0.0".
warning "@jupyterlab/json-extension > [email protected]" has incorrect peer dependency "react@^16.3.0".
warning "@jupyterlab/json-extension > [email protected]" has incorrect peer dependency "react-dom@^16.3.0".
warning "@jupyterlab/ui-components > @blueprintjs/core > [email protected]" has incorrect peer dependency "[email protected] || ^15.0.0 || ^16.0.0".
warning "@jupyterlab/ui-components > @blueprintjs/core > react-popper > [email protected]" has incorrect peer dependency "react@^0.14.0 || ^15.0.0 || ^16.0.0".
warning "@jupyterlab/vdom > @nteract/[email protected]" has incorrect peer dependency "react@^16.3.2".
warning " > @lumino/[email protected]" has unmet peer dependency "[email protected]".
[5/5] Building fresh packages...
success Saved lockfile.
Done in 5.77s.

[LabBuildApp] > node c:\users\acrul\anaconda3\lib\site-packages\jupyterlab\staging\yarn.js yarn-deduplicate -s fewer --fail
[LabBuildApp] yarn run v1.21.1
$ c:\users\acrul\anaconda3\share\jupyter\lab\staging\node_modules\.bin\yarn-deduplicate -s fewer --fail
Done in 0.45s.

[LabBuildApp] > node c:\users\acrul\anaconda3\lib\site-packages\jupyterlab\staging\yarn.js run build:prod:minimize
[LabBuildApp] yarn run v1.21.1
$ webpack --config webpack.prod.minimize.config.js
[webpack-cli] [31mTypeError: The 'compilation' argument must be an instance of Compilation
    at Function.getCompilationHooks (c:\users\acrul\anaconda3\share\jupyter\lab\staging\node_modules\webpack\lib\javascript\JavascriptModulesPlugin.js:119:10)
    at c:\users\acrul\anaconda3\share\jupyter\lab\staging\node_modules\terser-webpack-plugin\dist\index.js:566:67
    at _next35 (eval at create (c:\Users\acrul\anaconda3\share\jupyter\lab\staging\node_modules\tapable\lib\HookCodeFactory.js:19:10),<anonymous>:40:1)
    at _next13 (eval at create (c:\Users\acrul\anaconda3\share\jupyter\lab\staging\node_modules\tapable\lib\HookCodeFactory.js:19:10),<anonymous>:97:1)
    at Hook.eval [as call] (eval at create (c:\Users\acrul\anaconda3\share\jupyter\lab\staging\node_modules\tapable\lib\HookCodeFactory.js:19:10),<anonymous>:127:1)
    at Hook.CALL_DELEGATE [as _call] (c:\Users\acrul\anaconda3\share\jupyter\lab\staging\node_modules\tapable\lib\Hook.js:14:14)
    at Compiler.newCompilation (c:\Users\acrul\anaconda3\share\jupyter\lab\staging\node_modules\webpack\lib\Compiler.js:988:26)
    at c:\Users\acrul\anaconda3\share\jupyter\lab\staging\node_modules\webpack\lib\Compiler.js:1030:29
    at Hook.eval [as callAsync] (eval at create (c:\Users\acrul\anaconda3\share\jupyter\lab\staging\node_modules\tapable\lib\HookCodeFactory.js:33:10),<anonymous>:6:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (c:\Users\acrul\anaconda3\share\jupyter\lab\staging\node_modules\tapable\lib\Hook.js:18:14)[39m
error Command Failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

[LabBuildApp] JupyterLab Failed to build
[LabBuildApp] Traceback (most recent call last):

[LabBuildApp]   File "c:\users\acrul\anaconda3\lib\site-packages\jupyterlab\debuglog.py",line 47,in debug_logging
    yield

[LabBuildApp]   File "c:\users\acrul\anaconda3\lib\site-packages\jupyterlab\labapp.py",line 168,in start
    raise e

[LabBuildApp]   File "c:\users\acrul\anaconda3\lib\site-packages\jupyterlab\labapp.py",line 164,in start
    build(name=self.name,version=self.version,[LabBuildApp]   File "c:\users\acrul\anaconda3\lib\site-packages\jupyterlab\commands.py",line 463,in build
    return handler.build(name=name,version=version,static_url=static_url,line 675,in build
    raise RuntimeError(msg)

[LabBuildApp] RuntimeError: JupyterLab Failed to build

[LabBuildApp] Exiting application: JupyterLab

解决方法

不知道我是怎么解决的,但我反复以管理员身份运行这些

jupyter lab clean
jupyter lab clean --all
pip uninstall jupyterlab
pip install jupyterlab

然后还从另一个文件夹中启动了 jupyter lab 服务器。