Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.0.0 broken - can't resolve 'worker-loader' in '/opt/conda/share/jupyter/lab/staging/node_modules/pdfjs-dist' #135

Closed
donotpush opened this issue Jun 3, 2020 · 13 comments

Comments

@donotpush
Copy link

donotpush commented Jun 3, 2020

Hi there,

The package pdfjs-dist has been released two days ago to the version v2.5.207. Jupyterlab-latex accepts any patch or minor update higher than ^2.0.943.

Link to latex dependency:
https://github.com/jupyterlab/jupyterlab-latex/blob/master/package.json#L63

Links to the upstream issue

https://github.com/mozilla/pdfjs-dist/releases
https://github.com/mozilla/pdf.js/issues/11925

We are using jupyter/tensorflow-notebook:latest to install jupyterlab/latex. Full steps to reproduce the error in our case:

➜  ~ docker run -it jupyter/tensorflow-notebook:latest  bash
jovyan@5ed9b29c83c3:~$ jupyter labextension install @jupyterlab/latex
Building jupyterlab assets (build:prod:minimize)
An error occured.
RuntimeError: JupyterLab failed to build
See the log file for details:  /tmp/jupyterlab-debug-s7wqd0x1.log

Debug log:

jovyan@5ed9b29c83c3:~$ cat /tmp/jupyterlab-debug-s7wqd0x1.log
Node v13.13.0

Yarn configuration loaded.
> /opt/conda/bin/npm pack @jupyterlab/latex
npm notice
npm notice 📦  @jupyterlab/latex@2.0.0
npm notice === Tarball Contents ===
npm notice 2.2kB  package.json
npm notice 1.5kB  LICENSE
npm notice 3.0kB  README.md
npm notice 746B   lib/error.d.ts
npm notice 1.2kB  lib/error.js
npm notice 637B   lib/index.d.ts
npm notice 18.7kB lib/index.js
npm notice 1.1kB  lib/pagenumber.d.ts
npm notice 4.2kB  lib/pagenumber.js
npm notice 3.8kB  lib/pdf.d.ts
npm notice 17.3kB lib/pdf.js
npm notice 401B   schema/plugin.json
npm notice 600B   style/fit_dark.svg
npm notice 600B   style/fit_light.svg
npm notice 2.6kB  style/index.css
npm notice 213B   style/next_dark.svg
npm notice 213B   style/next_light.svg
npm notice 210B   style/previous_dark.svg
npm notice 210B   style/previous_light.svg
npm notice 450B   style/zoom_in_dark.svg
npm notice 450B   style/zoom_in_light.svg
npm notice 411B   style/zoom_out_dark.svg
npm notice 411B   style/zoom_out_light.svg
npm notice === Tarball Details ===
npm notice name:          @jupyterlab/latex
npm notice version:       2.0.0
npm notice filename:      jupyterlab-latex-2.0.0.tgz
npm notice package size:  15.4 kB
npm notice unpacked size: 61.3 kB
npm notice shasum:        28ae0f04a4d1f9da4f9a8120e0aa308ee5e29efa
npm notice integrity:     sha512-uPjv+QY+TXOux[...]sGZsoPJ6aknQA==
npm notice total files:   23
npm notice
jupyterlab-latex-2.0.0.tgz

Node v13.13.0

Yarn configuration loaded.
Building jupyterlab assets (build:prod:minimize)
> node /opt/conda/lib/python3.7/site-packages/jupyterlab/staging/yarn.js install --non-interactive
yarn install v1.21.1
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
warning @blueprintjs/core@3.28.0: Invalid bin entry for "upgrade-blueprint-2.0.0-rename" (in "@blueprintjs/core").
warning @blueprintjs/core@3.28.0: Invalid bin entry for "upgrade-blueprint-3.0.0-rename" (in "@blueprintjs/core").
warning sha.js@2.4.11: Invalid bin entry for "sha.js" (in "sha.js").
info fsevents@2.1.3: The platform "linux" 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 "linux" 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...
[5/5] Building fresh packages...
success Saved lockfile.
Done in 62.72s.

> node /opt/conda/lib/python3.7/site-packages/jupyterlab/staging/yarn.js yarn-deduplicate -s fewer --fail
yarn run v1.21.1
$ /opt/conda/share/jupyter/lab/staging/node_modules/.bin/yarn-deduplicate -s fewer --fail
Done in 0.81s.

> node /opt/conda/lib/python3.7/site-packages/jupyterlab/staging/yarn.js run build:prod:minimize
yarn run v1.21.1
$ ensure-max-old-space webpack --config webpack.prod.minimize.config.js
ModuleNotFoundError: Module not found: Error: Can't resolve 'worker-loader' in '/opt/conda/share/jupyter/lab/staging/node_modules/pdfjs-dist'
    at /opt/conda/share/jupyter/lab/staging/node_modules/webpack/lib/Compilation.js:925:10
    at /opt/conda/share/jupyter/lab/staging/node_modules/webpack/lib/NormalModuleFactory.js:401:22
    at /opt/conda/share/jupyter/lab/staging/node_modules/webpack/lib/NormalModuleFactory.js:130:21
    at /opt/conda/share/jupyter/lab/staging/node_modules/webpack/lib/NormalModuleFactory.js:224:22
    at /opt/conda/share/jupyter/lab/staging/node_modules/neo-async/async.js:2830:7
    at /opt/conda/share/jupyter/lab/staging/node_modules/neo-async/async.js:6877:13
    at /opt/conda/share/jupyter/lab/staging/node_modules/neo-async/async.js:2830:7
    at done (/opt/conda/share/jupyter/lab/staging/node_modules/neo-async/async.js:2925:13)
    at /opt/conda/share/jupyter/lab/staging/node_modules/webpack/lib/NormalModuleFactory.js:449:23
    at /opt/conda/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:184:12
    at /opt/conda/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5
    at eval (eval at create (/opt/conda/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
    at /opt/conda/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:37:5
    at /opt/conda/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5
    at eval (eval at create (/opt/conda/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
    at /opt/conda/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5
    at eval (eval at create (/opt/conda/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:25:1)
    at /opt/conda/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:42:38
    at /opt/conda/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5
    at eval (eval at create (/opt/conda/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:25:1)
    at /opt/conda/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/ModuleKindPlugin.js:23:37
    at /opt/conda/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5
    at eval (eval at create (/opt/conda/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
    at /opt/conda/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5
    at eval (eval at create (/opt/conda/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
    at /opt/conda/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/forEachBail.js:30:14
    at /opt/conda/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5
    at eval (eval at create (/opt/conda/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
    at /opt/conda/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:37:5
    at /opt/conda/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5
    at eval (eval at create (/opt/conda/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
    at /opt/conda/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5
    at eval (eval at create (/opt/conda/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:25:1)
    at /opt/conda/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:42:38
    at /opt/conda/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5
    at eval (eval at create (/opt/conda/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:14:1)
resolve 'worker-loader' in '/opt/conda/share/jupyter/lab/staging/node_modules/pdfjs-dist'
  Parsed request is a module
  using description file: /opt/conda/share/jupyter/lab/staging/node_modules/pdfjs-dist/package.json (relative path: .)
    resolve as module
      /opt/conda/share/jupyter/lab/staging/node_modules/pdfjs-dist/node_modules doesn't exist or is not a directory
      /opt/conda/share/jupyter/lab/staging/node_modules/node_modules doesn't exist or is not a directory
      /opt/conda/share/jupyter/lab/node_modules doesn't exist or is not a directory
      /opt/conda/share/jupyter/node_modules doesn't exist or is not a directory
      /opt/conda/share/node_modules doesn't exist or is not a directory
      /opt/conda/node_modules doesn't exist or is not a directory
      /opt/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
      looking for modules in /opt/conda/share/jupyter/lab/staging/node_modules
        using description file: /opt/conda/share/jupyter/lab/staging/package.json (relative path: ./node_modules)
          using description file: /opt/conda/share/jupyter/lab/staging/package.json (relative path: ./node_modules/worker-loader)
            no extension
              /opt/conda/share/jupyter/lab/staging/node_modules/worker-loader doesn't exist
            .js
              /opt/conda/share/jupyter/lab/staging/node_modules/worker-loader.js doesn't exist
            .json
              /opt/conda/share/jupyter/lab/staging/node_modules/worker-loader.json doesn't exist
            as directory
              /opt/conda/share/jupyter/lab/staging/node_modules/worker-loader doesn't exist
child_process.js:632
    throw err;
    ^

Error: Command failed: /opt/conda/share/jupyter/lab/staging/node_modules/.bin/webpack --config webpack.prod.minimize.config.js
    at checkExecSyncError (child_process.js:611:11)
    at Object.execFileSync (child_process.js:629:15)
    at Object.<anonymous> (/opt/conda/share/jupyter/lab/staging/node_modules/@jupyterlab/buildutils/lib/ensure-max-old-space.js:38:17)
    at Module._compile (internal/modules/cjs/loader.js:1123:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
    at Module.load (internal/modules/cjs/loader.js:972:32)
    at Function.Module._load (internal/modules/cjs/loader.js:872:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 215,
  stdout: null,
  stderr: null
}
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 "/opt/conda/lib/python3.7/site-packages/jupyterlab/debuglog.py", line 47, in debug_logging
    yield

  File "/opt/conda/lib/python3.7/site-packages/jupyterlab/labextensions.py", line 105, in start
    command=command, app_options=app_options)

  File "/opt/conda/lib/python3.7/site-packages/jupyterlab/commands.py", line 460, in build
    command=command, clean_staging=clean_staging)

  File "/opt/conda/lib/python3.7/site-packages/jupyterlab/commands.py", line 661, in build
    raise RuntimeError(msg)

RuntimeError: JupyterLab failed to build

Exiting application: jupyter
@scottweitzner
Copy link
Collaborator

@donotpush +1
We're noticing this issue as well. Pretty much identical output to the above. I can post if necessary, but the output has been reformatted to be pretty ugly due to ansible stderr output

Jupyter Lab Version: 2.1.4
Nodejs Version: 13.13.0

My team was using v2.0.0, another using v1.0.0 of jupyter/latex and both of us had this error. Our build pipeline was running fine up until yesterday

@singh-ramanpreet
Copy link

I am experiencing the same issue. It was working until few days ago, now I am not able to use jupyterlab_latex.

@ian-r-rose
Copy link
Member

Thanks for flagging this @donotpush. At one point we had pinned pdfjs-dist to a specific version (rather than ^) for reasons like this -- pdfjs doesn't really respect semver. I'm not sure why that reverted, it was probably an error.

In the short term, we can probably just remove the ^ and publish a new patch release here. Longer-term, we should try to figure out how to update to a more recent version of pdfjs.

@scottweitzner
Copy link
Collaborator

scottweitzner commented Jun 5, 2020

Just a heads up to everyone, it looks like an MR was created/merged for the upstream dependency (pdfjs) to address this issue. Can be found here

@aplum
Copy link

aplum commented Jun 5, 2020

Unfortunately the PR #11964 mentioned by @scottweitzner won't fix this issue. As of PR #11474, it is required to install worker-loader in your project if you want to import pdfjs-dist/webpack. This is not going to change (see #11474 for the reasoning behind this).

If you were to go ahead and install worker-loader right now, you might then get further errors, depending on your webpack config. I'm not seeing target specified in the configs mentioned in the logs above, so if it's the default web you will likely see these errors as webpack tries to load some built-in node modules. See this gist for a small repro. These further errors – after you install worker-loader – are what PR #11964 fixes.

I'm not at all familiar with jupyterlab, but from a quick glance around I'm seeing a couple of possible solutions:

  1. Add worker-loader as a dependency somewhere (jupyterlab-latex or jupyterlab?), and until PR #11964 is available, configure webpack externals in jupyterlab as shown in the gist.
  2. Avoid using pdfjs-dist/webpack in pdf.ts, and instead configure pdfjs manually (perhaps something like this).

@jhgoebbert
Copy link

We're noticing this issue as well. Wouldn´t it be the easiest for now to remove the ^ and publish a new patch release. Currently jupyterlab-latex is broken.

@sntgluca
Copy link

Hi all,

stumbling on this one as well. Is there a simple alternative, i.e. using a different version of the extension, which one can use without handling dependencies?

Even better, is there a plan to fix this soon? I feel there's no alternative at the moment apart from waiting!

Thanks :)

@singh-ramanpreet
Copy link

Here is an alternative solution,

  1. Clone this repository git clone https://github.com/jupyterlab/jupyterlab-latex.git
  2. cd jupyterlab-latex
  3. Edit the file package.json as others have suggested, remove ^ from the line 63: "pdfjs-dist": "^2.0.943"
  4. Then finally do
jlpm install
jlpm run build
jupyter labextension install .

@jhgoebbert
Copy link

@jhgoebbert
Copy link

But just a quick upgrade to JupyterLab 2.1.5 does not fix the problem for me :(
jupyterlab-latex still does not install.

@scottweitzner
Copy link
Collaborator

Following the advice of @singh-ramanpreet I have created a PR (link above this comment) as a temp fix

@sntgluca
Copy link

Hi @singh-ramanpreet ,
just wanted to thank you for your suggestion, worked perfectly!

In case anyone wanted a patch, maybe to automate it... this should work:

*** package.json.bak    2020-06-27 10:36:20.923358000 +0200
--- package.json        2020-06-27 10:36:33.885417000 +0200
***************
*** 60,66 ****
      "@lumino/domutils": "^1.1.3",
      "@lumino/messaging": "^1.2.3",
      "@lumino/widgets": "^1.8.0",
!     "pdfjs-dist": "^2.0.943",
      "react": "^16.8.6",
      "react-dom": "^16.8.6"
    },
--- 60,66 ----
      "@lumino/domutils": "^1.1.3",
      "@lumino/messaging": "^1.2.3",
      "@lumino/widgets": "^1.8.0",
!     "pdfjs-dist": "2.0.943",
      "react": "^16.8.6",
      "react-dom": "^16.8.6"
    },

Save it as jlab-latex.patch and use it via patch -i jlab-latex.patch package.json from within the jupyterlab-latex` dir.

yuvipanda added a commit to yuvipanda/datahub-old-fork that referenced this issue Aug 3, 2020
@ian-r-rose
Copy link
Member

Fixed by #137 , and published in v2.0.1. Sorry for the slow turnaround all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants