Code Monkey home page Code Monkey logo

Comments (6)

acrisci avatar acrisci commented on May 25, 2024 1

Try this:

diff --git a/webpack/config.electron.js b/webpack/config.electron.js
index 297e8cb..208e647 100644
--- a/webpack/config.electron.js
+++ b/webpack/config.electron.js
@@ -15,5 +15,10 @@ module.exports = {
   target: 'electron-main',
   node: {
     __dirname: false
+  },
+  resolve: {
+    alias: {
+      jsbi: path.resolve(__dirname, '..', 'node_modules', 'jsbi', 'dist', 'jsbi-cjs.js')
+    }
   }
 }

Note that the exact solution above won't work because your node_modules is at a different relative path. You have to add the '..' to the resolve path.

from mpris-service.

rapiz1 avatar rapiz1 commented on May 25, 2024
App threw an error during load
TypeError: JSBI.BigInt is not a function
    at eval (webpack:///./node_modules/dbus-next/lib/marshallers.js?:255:24)
    at Object../node_modules/dbus-next/lib/marshallers.js (/home/rapiz/Source/Petal/public/main.js:503:1)
    at __webpack_require__ (/home/rapiz/Source/Petal/public/main.js:20:30)
    at eval (webpack:///./node_modules/dbus-next/lib/marshall.js?:5:21)
    at Object../node_modules/dbus-next/lib/marshall.js (/home/rapiz/Source/Petal/public/main.js:492:1)
    at __webpack_require__ (/home/rapiz/Source/Petal/public/main.js:20:30)
    at eval (webpack:///./node_modules/dbus-next/lib/message.js?:2:18)
    at Object../node_modules/dbus-next/lib/message.js (/home/rapiz/Source/Petal/public/main.js:514:1)
    at __webpack_require__ (/home/rapiz/Source/Petal/public/main.js:20:30)
    at eval (webpack:///./node_modules/dbus-next/lib/connection.js?:3:17)
A JavaScript error occurred in the main process
Uncaught Exception:
TypeError: JSBI.BigInt is not a function
    at eval (webpack:///./node_modules/dbus-next/lib/marshallers.js?:255:24)
    at Object../node_modules/dbus-next/lib/marshallers.js (/home/rapiz/Source/Petal/public/main.js:503:1)
    at __webpack_require__ (/home/rapiz/Source/Petal/public/main.js:20:30)
    at eval (webpack:///./node_modules/dbus-next/lib/marshall.js?:5:21)
    at Object../node_modules/dbus-next/lib/marshall.js (/home/rapiz/Source/Petal/public/main.js:492:1)
    at __webpack_require__ (/home/rapiz/Source/Petal/public/main.js:20:30)
    at eval (webpack:///./node_modules/dbus-next/lib/message.js?:2:18)
    at Object../node_modules/dbus-next/lib/message.js (/home/rapiz/Source/Petal/public/main.js:514:1)
    at __webpack_require__ (/home/rapiz/Source/Petal/public/main.js:20:30)
    at eval (webpack:///./node_modules/dbus-next/lib/connection.js?:3:17)

Looks similar to #23 . So I applied the solution in that.
Got:

WARNING in ./node_modules/dbus-next/lib/address-x11.js
Module not found: Error: Can't resolve 'x11' in '/home/rapiz/Source/Petal/node_modules/dbus-next/lib'
 @ ./node_modules/dbus-next/lib/address-x11.js
 @ ./node_modules/dbus-next/lib/connection.js
 @ ./node_modules/dbus-next/index.js
 @ ./node_modules/mpris-service/dist/index.js
 @ ./electron/mpris.js
 @ ./electron/main.dev.js

ERROR in ./node_modules/dbus-next/lib/dbus-buffer.js
Module not found: Error: Can't resolve 'jsbi' in '/home/rapiz/Source/Petal/node_modules/dbus-next/lib'
 @ ./node_modules/dbus-next/lib/dbus-buffer.js 3:13-28
 @ ./node_modules/dbus-next/lib/message.js
 @ ./node_modules/dbus-next/lib/connection.js
 @ ./node_modules/dbus-next/index.js
 @ ./node_modules/mpris-service/dist/index.js
 @ ./electron/mpris.js
 @ ./electron/main.dev.js

ERROR in ./node_modules/dbus-next/lib/marshallers.js
Module not found: Error: Can't resolve 'jsbi' in '/home/rapiz/Source/Petal/node_modules/dbus-next/lib'
 @ ./node_modules/dbus-next/lib/marshallers.js 4:13-28
 @ ./node_modules/dbus-next/lib/marshall.js
 @ ./node_modules/dbus-next/lib/message.js
 @ ./node_modules/dbus-next/lib/connection.js
 @ ./node_modules/dbus-next/index.js
 @ ./node_modules/mpris-service/dist/index.js
 @ ./electron/mpris.js
 @ ./electron/main.dev.js

ERROR in ./node_modules/mpris-service/dist/interfaces/player.js
Module not found: Error: Can't resolve 'jsbi' in '/home/rapiz/Source/Petal/node_modules/mpris-service/dist/interfaces'
 @ ./node_modules/mpris-service/dist/interfaces/player.js 35:13-28
 @ ./node_modules/mpris-service/dist/index.js
 @ ./electron/mpris.js
 @ ./electron/main.dev.js
error Command failed with exit code 2.

from mpris-service.

rapiz1 avatar rapiz1 commented on May 25, 2024

Tried to edit ./node_modules/mpris-sevice/src/index.js and ./node_modules/mpris-sevice/dist/index.js. Change dbus.setBigIntCompat(true); to dbus.setBigIntCompat(false); but did not work. The same error. TypeError: JSBI.BigInt is not a function
In my understanding of node-dbus-next#Compat, after I changed the compat option it would not use JSBI and it would not produce a error containing JSBI stuff. It's really confusing.

from mpris-service.

acrisci avatar acrisci commented on May 25, 2024

Change dbus.setBigIntCompat(true); to dbus.setBigIntCompat(false); but did not work.

This only affects what the public api returns. Internally, it still uses JSBI because it simplifies the code path. But maybe that should be revisited and we should make that dependency really optional since it seems to be causing webpack problems.

Can you link to your branch where you are working on the implementation so I can look at it?

from mpris-service.

rapiz1 avatar rapiz1 commented on May 25, 2024

https://github.com/Rapiz1/Petal/tree/94e19158771fe947aa3f0308b3084d155cf2238e
I have not really implement it yet. Just tested.
electron/mpris.js mostly comes from mpris-service example code.
electron/main.dev.js just add the line import './mpris'

from mpris-service.

rapiz1 avatar rapiz1 commented on May 25, 2024

It works.Thanks :)

from mpris-service.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.