首页 > 解决方案 > Jupyter labextension install @jupyterlab/toc 返回错误:Jupyterlab 构建失败

问题描述

我已经通过 conda 安装了 nodejs 没有问题:

(tf2) C:\WINDOWS\system32>conda install -c anaconda nodejs
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: C:\Users\Alienware\Anaconda3\envs\tf2

  added / updated specs:
    - nodejs


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    nodejs-10.13.0             |                0        13.2 MB  anaconda
    ------------------------------------------------------------
                                           Total:        13.2 MB

The following packages will be SUPERSEDED by a higher-priority channel:

  nodejs                       conda-forge::nodejs-13.0.0-1 --> anaconda::nodejs-10.13.0-0


Proceed ([y]/n)? y


Downloading and Extracting Packages
nodejs-10.13.0       | 13.2 MB   | ############################################################################ | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

然后我运行(tf2) C:\WINDOWS\system32>jupyter labextension install @jupyterlab/toc 它返回一个异常:

Building jupyterlab assets (build:prod:minimize)
An error occured.
RuntimeError: JupyterLab failed to build
See the log file for details:  C:\Users\Alienware\AppData\Local\Temp\jupyterlab-debug-41ynux3v.log

日志文件有以下内容:

Yarn configuration loaded.
Node v10.13.0

> C:\Users\Alienware\Anaconda3\envs\tf2\npm.CMD pack @jupyterlab/toc
npm notice 
npm notice package: @jupyterlab/toc@1.0.1
npm notice === Tarball Contents === 
npm notice 2.2kB  package.json                                             
npm notice 1.5kB  LICENSE                                                  
npm notice 1.2kB  README.md                                                
npm notice 314B   lib/extension.d.ts                                       
npm notice 3.4kB  lib/extension.js                                         
npm notice 111B   lib/generators/index.d.ts                                
npm notice 403B   lib/generators/index.js                                  
npm notice 474B   lib/generators/latexgenerator.d.ts                       
npm notice 2.4kB  lib/generators/latexgenerator.js                         
npm notice 1.1kB  lib/generators/markdowndocgenerator/index.d.ts           
npm notice 7.9kB  lib/generators/markdowndocgenerator/index.js             
npm notice 248B   lib/generators/markdowndocgenerator/itemrenderer.d.ts    
npm notice 1.0kB  lib/generators/markdowndocgenerator/itemrenderer.js      
npm notice 549B   lib/generators/markdowndocgenerator/optionsmanager.d.ts  
npm notice 930B   lib/generators/markdowndocgenerator/optionsmanager.js    
npm notice 1.2kB  lib/generators/markdowndocgenerator/toolbargenerator.d.ts
npm notice 1.7kB  lib/generators/markdowndocgenerator/toolbargenerator.js  
npm notice 546B   lib/generators/notebookgenerator/codemirror.d.ts         
npm notice 938B   lib/generators/notebookgenerator/codemirror.js           
npm notice 299B   lib/generators/notebookgenerator/heading.d.ts            
npm notice 180B   lib/generators/notebookgenerator/heading.js              
npm notice 549B   lib/generators/notebookgenerator/index.d.ts              
npm notice 18.2kB lib/generators/notebookgenerator/index.js                
npm notice 246B   lib/generators/notebookgenerator/itemrenderer.d.ts       
npm notice 5.0kB  lib/generators/notebookgenerator/itemrenderer.js         
npm notice 1.2kB  lib/generators/notebookgenerator/optionsmanager.d.ts     
npm notice 2.9kB  lib/generators/notebookgenerator/optionsmanager.js       
npm notice 1.0kB  lib/generators/notebookgenerator/tagstool/index.d.ts     
npm notice 4.7kB  lib/generators/notebookgenerator/tagstool/index.js       
npm notice 348B   lib/generators/notebookgenerator/tagstool/tag.d.ts       
npm notice 632B   lib/generators/notebookgenerator/tagstool/tag.js         
npm notice 574B   lib/generators/notebookgenerator/tagstool/tagslist.d.ts  
npm notice 2.1kB  lib/generators/notebookgenerator/tagstool/tagslist.js    
npm notice 1.7kB  lib/generators/notebookgenerator/toolbargenerator.d.ts   
npm notice 7.7kB  lib/generators/notebookgenerator/toolbargenerator.js     
npm notice 1.1kB  lib/generators/shared.d.ts                               
npm notice 2.6kB  lib/generators/shared.js                                 
npm notice 81B    lib/index.d.ts                                           
npm notice 373B   lib/index.js                                             
npm notice 2.8kB  lib/registry.d.ts                                        
npm notice 1.8kB  lib/registry.js                                          
npm notice 3.6kB  lib/toc.d.ts                                             
npm notice 5.5kB  lib/toc.js                                               
npm notice 559B   style/img/autonumbering_darktheme.svg                    
npm notice 343B   style/img/autonumbering.svg                              
npm notice 264B   style/img/check.svg                                      
npm notice 320B   style/img/code_darktheme.svg                             
npm notice 305B   style/img/code.svg                                       
npm notice 669B   style/img/eyeball_hidden.svg                             
npm notice 619B   style/img/eyeball_hover.svg                              
npm notice 617B   style/img/eyeball_view.svg                               
npm notice 357B   style/img/markdown_darktheme.svg                         
npm notice 363B   style/img/markdown.svg                                   
npm notice 264B   style/img/menu_arrow.svg                                 
npm notice 523B   style/img/numbering.svg                                  
npm notice 762B   style/img/tag_darktheme.svg                              
npm notice 1.2kB  style/img/tag.svg                                        
npm notice 202B   style/img/toggle_down_darktheme.svg                      
npm notice 181B   style/img/toggle_down.svg                                
npm notice 189B   style/img/toggle_right_darktheme.svg                     
npm notice 187B   style/img/toggle_right.svg                               
npm notice 9.3kB  style/index.css                                          
npm notice 625B   style/list-dark.svg                                      
npm notice 625B   style/list-light.svg                                     
npm notice === Tarball Details === 
npm notice name:          @jupyterlab/toc                         
npm notice version:       1.0.1                                   
npm notice filename:      jupyterlab-toc-1.0.1.tgz                
npm notice package size:  24.7 kB                                 
npm notice unpacked size: 111.9 kB                                
npm notice shasum:        dc2551e628104e66be81fab287e46ea1af272584
npm notice integrity:     sha512-6AQt/7qjNionI[...]hMcGnlF7p+NdQ==
npm notice total files:   64                                      
npm notice 
jupyterlab-toc-1.0.1.tgz

Yarn configuration loaded.
Node v10.13.0

Building jupyterlab assets (build:prod:minimize)
> node C:\Users\Alienware\Anaconda3\envs\tf2\lib\site-packages\jupyterlab\staging\yarn.js install --non-interactive
yarn install v1.15.2
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
info fsevents@1.2.9: The platform "win32" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
[5/5] Building fresh packages...
success Saved lockfile.
Done in 4.89s.

> node C:\Users\Alienware\Anaconda3\envs\tf2\lib\site-packages\jupyterlab\staging\yarn.js yarn-deduplicate -s fewer
yarn run v1.15.2
$ C:\Users\Alienware\Anaconda3\envs\tf2\share\jupyter\lab\staging\node_modules\.bin\yarn-deduplicate -s fewer
Done in 0.50s.

> node C:\Users\Alienware\Anaconda3\envs\tf2\lib\site-packages\jupyterlab\staging\yarn.js run build:prod:minimize
yarn run v1.15.2
$ ensure-max-old-space webpack --config webpack.prod.minimize.config.js
child_process.js:632
    throw err;
    ^

Error: spawnSync webpack ENOENT
    at Object.spawnSync (internal/child_process.js:982:20)
    at spawnSync (child_process.js:596:24)
    at Object.execFileSync (child_process.js:624:13)
    at Object.<anonymous> (C:\Users\Alienware\Anaconda3\envs\tf2\share\jupyter\lab\staging\node_modules\@jupyterlab\buildutils\lib\ensure-max-old-space.js:30:17)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

JupyterLab failed to build
Traceback (most recent call last):

  File "C:\Users\Alienware\Anaconda3\envs\tf2\lib\site-packages\jupyterlab\debuglog.py", line 47, in debug_logging
    yield

  File "C:\Users\Alienware\Anaconda3\envs\tf2\lib\site-packages\jupyterlab\labextensions.py", line 105, in start
    command=command, app_options=app_options)

  File "C:\Users\Alienware\Anaconda3\envs\tf2\lib\site-packages\jupyterlab\commands.py", line 459, in build
    command=command, clean_staging=clean_staging)

  File "C:\Users\Alienware\Anaconda3\envs\tf2\lib\site-packages\jupyterlab\commands.py", line 669, in build
    raise RuntimeError(msg)

RuntimeError: JupyterLab failed to build

Exiting application: jupyter

我该如何解决这个问题?

标签: node.jspython-3.xcondajupyter-lab

解决方案


这适用于我的跑步:Microsoft Windows 7 Professional 6.1。

开始菜单>>Anaconda 提示

首先运行以下 npm 下载,然后安装

npm install -g ijavascript
ijsinstall

推荐阅读