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

Module Parse Error in WorkerJob Class: Unexpected Token in @loaders.gl/worker-utils #2593

Open
DanielLanghann opened this issue Jul 23, 2024 · 12 comments
Labels
bug Something isn't working

Comments

@DanielLanghann
Copy link

DanielLanghann commented Jul 23, 2024

Describe the bug
When i run yarn start i got among others this error:

ERROR in ./node_modules/@loaders.gl/worker-utils/dist/lib/worker-farm/worker-job.js 9:8
Module parse failed: Unexpected token (9:8)
File was processed with these loaders:
 * ../../node_modules/source-map-loader/dist/cjs.js
 * ../../node_modules/source-map-loader/dist/cjs.js
You may need an additional loader to handle the result of these loaders.
|  */
| export default class WorkerJob {
>     name;
|     workerThread;
|     isRunning = true;
 @ ./node_modules/@loaders.gl/worker-utils/dist/index.js 9:0-71 9:0-71
 @ ./node_modules/@loaders.gl/arrow/dist/triangulate-on-worker.js
 @ ./node_modules/@loaders.gl/arrow/dist/index.js
 @ ./src/actions.js
 @ ./src/app.js
 @ ./src/main.js
「wdm」: Failed to compile.

I attached the entire list of errors:

stack_trace_kepler.txt

To Reproduce
Steps to reproduce the behavior:

I work on MacOS (14.4.1).
and use Node: v18.18.2 (I also tried newer versions)

  1. I fork the repository (and did no changes).
  2. Run: yarn global add puppeteer
  3. Run: yarn bootstrap
  4. Run: export MapboxAccessToken=<insert_my_token>
  5. Run: yarn start
    Now i got the attached Error Trace.

Additional context
Can anyone give me a hint on how to get Kepler running locally?
I tried working through the errors one by one, but no matter what I did, I kept having compatibility issues and was unable (for the past two days) to run the app.
We also tried running the steps on an Ubuntu machine and launching the app in Docker.
Also tried newer Versions of Node.
Thank you in advance for your feedback. WR Daniel

@DanielLanghann DanielLanghann added the bug Something isn't working label Jul 23, 2024
@ibgreen
Copy link
Collaborator

ibgreen commented Jul 23, 2024

@igorDykhta Could it be yarn version issue?

@igorDykhta
Copy link
Collaborator

igorDykhta commented Jul 23, 2024

I'll check. I have a different issue on my side, but related to loaders.gl as well. The fork works with the same yarn version.

@ibgreen i see that there is a special rule added by @lixun910 for @probe.gl in kepler.gl-jupyter

// for compiling @probe.gl, website build started to fail (March, 2024)
  {
    test: /\.(js|ts)$/,
    loader: 'babel-loader',
    include: [
      /node_modules\/@probe.gl/,
      /node_modules\/@loaders.gl/,
      /node_modules\/@math.gl/
    ]
  }

@lixun910
Copy link
Collaborator

Thanks, Igor! I remember I added this one for kepler-jupyter build, and it should not impact kepler build?
Screenshot 2024-07-23 at 9 23 52 AM

@igorDykhta
Copy link
Collaborator

@DanielLanghann Could you try running igr/fix-yarn-start branch? I can't reproduce the exact error, but maybe the fix is similar to probe.gl fix.

@DanielLanghann
Copy link
Author

@igorDykhta Could it be yarn version issue?

I'm using yarn 1.22.19 on my machine.

@DanielLanghann
Copy link
Author

@DanielLanghann Could you try running igr/fix-yarn-start branch? I can't reproduce the exact error, but maybe the fix is similar to probe.gl fix.

@igorDykhta First, thank you for your help! I cloned the repository to have a fresh start, switched to branch igr/fix-yarn-startand run yarn global add puppeteer, yarn bootstrap, export MapboxAccessToken=<my_token> and yarn start. The last success message in the build process is success Saved lockfile. After a few warnings (almost) related to @loaders.gl I got many errors also related to @loaders.gl. Most errors are "Module parse failed: Unexpected token" errors. I'm not a Java Script Pro, but for me it seems that the current build setup is not able to parse or transpile correctly or handling the syntax of used java script features.

@pablos1rvent
Copy link

@DanielLanghann Could you try running igr/fix-yarn-start branch? I can't reproduce the exact error, but maybe the fix is similar to probe.gl fix.

@igorDykhta First, thank you for your help! I cloned the repository to have a fresh start, switched to branch igr/fix-yarn-startand run yarn global add puppeteer, yarn bootstrap, export MapboxAccessToken=<my_token> and yarn start. The last success message in the build process is success Saved lockfile. After a few warnings (almost) related to @loaders.gl I got many errors also related to @loaders.gl. Most errors are "Module parse failed: Unexpected token" errors. I'm not a Java Script Pro, but for me it seems that the current build setup is not able to parse or transpile correctly or handling the syntax of used java script features.

Same here

@Devidian
Copy link

Hi, i've also tried to get this repo running locally somehow but always failed so far.

I've checked out igr/fix-yarn-start then yarn dlx puppeteer and yarn bootstrap which results in

➤ YN0000: ┌ Link step
➤ YN0007: │ gl@npm:6.0.2 must be built because it never has been before or the last one failed
➤ YN0009: │ gl@npm:6.0.2 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-3da27c8d/build.log)
# This file contains the result of Yarn building a package (gl@npm:6.0.2)
# Script name: install

prebuild-install warn install No prebuilt binaries found (target=20.12.0 runtime=node arch=x64 libc= platform=linux)
gyp info it worked if it ends with ok
gyp info using node-gyp@9.4.1
gyp info using node@20.12.0 | linux | x64
gyp info find Python using Python version 3.9.2 found at "/usr/bin/python3"
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/wsl2development/others/kepler.gl/node_modules/gl/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/wsl2development/others/kepler.gl/node_modules/gl/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/wsl2development/others/kepler.gl/node_modules/gl/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/root/.cache/node-gyp/20.12.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/root/.cache/node-gyp/20.12.0',
gyp info spawn args   '-Dnode_gyp_dir=/wsl2development/others/kepler.gl/node_modules/gl/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/20.12.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/wsl2development/others/kepler.gl/node_modules/gl',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
Package xi was not found in the pkg-config search path.
Perhaps you should add the directory containing `xi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'xi' found
gyp: Call to 'pkg-config --libs-only-L --libs-only-other x11 xi xext' returned exit status 1 while in angle/src/angle.gyp. while loading dependencies of binding.gyp while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/wsl2development/others/kepler.gl/node_modules/gl/node_modules/node-gyp/lib/configure.js:325:16)
gyp ERR! stack     at ChildProcess.emit (node:events:518:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
gyp ERR! System Linux 5.15.153.1-microsoft-standard-WSL2
gyp ERR! command "/root/.nvm/versions/node/v20.12.0/bin/node" "/wsl2development/others/kepler.gl/node_modules/gl/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /wsl2development/others/kepler.gl/node_modules/gl
gyp ERR! node -v v20.12.0
gyp ERR! node-gyp -v v9.4.1
gyp ERR! not ok 

I'am using stable yarn (4.3.1) by default but also tried with yarn 3.8.3 and 1.22.22 (yarn classic) with the same result.

@mars-dlx
Copy link
Contributor

mars-dlx commented Sep 5, 2024

@Devidian, this looks like a separate issue.

@DanielLanghann I have a fix. But I need to polish it a bit. Wll public PR soon.

@ibgreen
Copy link
Collaborator

ibgreen commented Sep 5, 2024

I am willing to take a look if there are loaders.gl specific issues. However @heshan0131 is in the process of modernizing the entire kepler build system so let's make sure we frame any bugs against the latest setups.

@mars-dlx
Copy link
Contributor

mars-dlx commented Sep 7, 2024

@Devidian I could reproduce it in WSL.

You need to install missed GL dependencies https://github.com/stackgl/headless-gl?tab=readme-ov-file#system-dependencies

@alcy
Copy link

alcy commented Sep 9, 2024

@mars-dlx I tried your "fix-webpack-builds" branch directly and at least for the demo-app which I had been trying to run so far (with the errors like @DanielLanghann was seeing) - it worked wonderfully. Thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants