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

Error: Cannot find module 'bigchaindb-driver' #296

Closed
drj1990 opened this issue Jun 20, 2019 · 5 comments
Closed

Error: Cannot find module 'bigchaindb-driver' #296

drj1990 opened this issue Jun 20, 2019 · 5 comments

Comments

@drj1990
Copy link

drj1990 commented Jun 20, 2019

Hello,

I am not able to make transaction to bigchaindb with node js. I have installed the npm module for bigchaindb by below command.

npm install bigchaindb-driver
I am using below code for writing transaction in a file app.js

const driver = require('bigchaindb-driver')

const alice = new driver.Ed25519Keypair()
const conn = new driver.Connection('http://35.225.89.2:9984/api/v1/')
const tx = driver.Transaction.makeCreateTransaction(
    { message: 'Blockchain all the things!' },
    null,
    [ driver.Transaction.makeOutput(
        driver.Transaction.makeEd25519Condition(alice.publicKey))],
    alice.publicKey)
const txSigned = driver.Transaction.signTransaction(tx, alice.privateKey)
conn.postTransactionCommit(txSigned)

But when i run the file in node as node app.js then i get error as

Error: Cannot find module 'bigchaindb-driver'

I have tried installing others module but they work fine.

@stefanvangastel
Copy link

stefanvangastel commented Jun 24, 2019

Same with latest version bigchaindb-driver@4.1.1, now using 4.1.0 as fallback that works.

@drj1990
Copy link
Author

drj1990 commented Jun 25, 2019

@stefanvangastel Thanks for sharing the information. I used version 4.1.0 and i am getting this error

/home/dhiraj/node_modules/base-x/index.js:29
    if (!Buffer.isBuffer(source)) throw new TypeError('Expected Buffer')
                                  ^

TypeError: Expected Buffer
    at Object.encode (/home/dhiraj/node_modules/base-x/index.js:29:41)
    at new Ed25519Keypair (/home/dhiraj/node_modules/bigchaindb-driver/dist/node/Ed25519Keypair.js:28:33)
    at Object.<anonymous> (/home/dhiraj/test.js:7:15)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)

I am using node code from below link
https://github.com/bigchaindb/js-bigchaindb-driver

@stefanvangastel
Copy link

I experienced the same issue, had to pin base-x and bip39 to specific versions due to outdated docs on bigchaindb-driver (And I'm lacking the knowhow to improve the docs):

 "dependencies": {
    "bigchaindb-driver": "4.1.0",
    "bip39": "^2.5.0",
    "base-x": "3.0.4"
  }

@drj1990
Copy link
Author

drj1990 commented Jun 25, 2019

@stefanvangastel Thanks for information. This seem to worked for me.
Do you think it is worth spending time on bigchaindb as it is not production ready.

@drj1990
Copy link
Author

drj1990 commented Jul 1, 2019

I experienced the same issue, had to pin base-x and bip39 to specific versions due to outdated docs on bigchaindb-driver (And I'm lacking the knowhow to improve the docs):

 "dependencies": {
    "bigchaindb-driver": "4.1.0",
    "bip39": "^2.5.0",
    "base-x": "3.0.4"
  }

Above solution worked for me.

@drj1990 drj1990 closed this as completed Jul 1, 2019
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