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

JSBI.BigInt is not a function /node_modules/dbus-next/lib/marshallers.js?:255:24 #59

Open
marcoippolito opened this issue Jul 14, 2020 · 8 comments

Comments

@marcoippolito
Copy link

Just importing dbus-next in a new javascript file causes this error:

DBus.js :

import { sessionBus, } from 'dbus-next';

image

Environment Info:

  System:
    OS: Linux 5.3 Ubuntu 18.04.4 LTS (Bionic Beaver)
    CPU: (8) x64 Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
  Binaries:
    Node: 14.3.0 - ~/.nvm/versions/node/v14.3.0/bin/node
    Yarn: 1.22.4 - /usr/bin/yarn
    npm: 6.14.5 - ~/.nvm/versions/node/v14.3.0/bin/npm
  Browsers:
    Chrome: 83.0.4103.116
    Firefox: 78.0.1
  npmGlobalPackages:
    @vue/cli: 4.4.4

"dbus-next": "^0.8.2"

How to solve the problem?

Marco

@acrisci
Copy link
Member

acrisci commented Jul 14, 2020

dbusjs/mpris-service#23

Put this in your webpack config:

resolve: {
  alias: {
    jsbi: path.resolve(__dirname, 'node_modules', 'jsbi', 'dist', 'jsbi-cjs.js')
  }
},

@marcoippolito
Copy link
Author

Hi @acrisci Tony!
After putting alias in webpack config should I do something else?

Now in webpack.config.js :

resolve: {
    extension: ["*", ".pem"],
    alias: {
        jsbi: path.resolve(__dirname, 'node_modules', 'jsbi', 'dist', 'jsbi-cjs.js')
    }
},

But I still have the same error

@acrisci
Copy link
Member

acrisci commented Jul 14, 2020

This fix has worked for 3-4 people. Make sure the path for the alias is actually pointing to an existing file in the node modules.

@marcoippolito
Copy link
Author

The path sbi: path.resolve(__dirname, 'node_modules', 'jsbi', 'dist', 'jsbi-cjs.js') seems correct:

(base) marco@pc01:~/webMatters/vueMatters/GGC/node_modules/jsbi/dist$ ls -lah
total 92K
drwxr-xr-x 2 marco marco 4,0K lug 14 14:45 .
drwxr-xr-x 3 marco marco 4,0K lug 14 14:45 ..
-rw-r--r-- 1 marco marco  26K lug 14 14:45 jsbi-cjs.js
-rw-r--r-- 1 marco marco  26K lug 14 14:45 jsbi.mjs
-rw-r--r-- 1 marco marco  25K lug 14 14:45 jsbi-umd.js

@acrisci
Copy link
Member

acrisci commented Jul 14, 2020

If you're using vue, I think the webpack config is a little different.

dbusjs/mpris-service#45

module.exports = {
  pluginOptions: {
    electronBuilder: {
      chainWebpackMainProcess: config => {
        config.resolve.alias.set('jsbi', path.join(__dirname, 'node_modules/jsbi/dist/jsbi-cjs.js'));
      }
    },
  },
};

@marcoippolito
Copy link
Author

I added at the end of webpack.config.js file :

module.exports = {
  pluginOptions: {
    electronBuilder: {
      chainWebpackMainProcess: config => {
        config.resolve.alias.set('jsbi', path.join(__dirname, 'node_modules/jsbi/dist/jsbi-cjs.js'));
      }
    },
  },
 };

But still get this error:

image

@acrisci
Copy link
Member

acrisci commented Aug 12, 2020

I think I might try to make JSBI optional so it never gets imported if you don't use it.

@acrisci
Copy link
Member

acrisci commented Aug 15, 2020

f1e2b4a should make the alias not required if you don't use jsbi compatibility mode. Try that out and see if it fixes it.

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

2 participants