bigchaindb / js-bigchaindb-driver

Official BigchainDB JavaScript driver for Node.js and the browser
https://docs.bigchaindb.com/projects/js-driver/en/latest/usage.html
Apache License 2.0
216 stars 92 forks source link

Module not found #289

Open DawgVonT opened 5 years ago

DawgVonT commented 5 years ago

Hi there,

I'm trying to create transactions using javascript (NodeJS) but ran in an annoying issue.

I have installed the module as described on the website, along with its dependencies, but whenever I try to import the module I get an module not found error.

Importing module: const driver = require('bigchaindb-driver')

Error:

$ nodemon server.js 
[nodemon] 1.19.0
[nodemon] to restart at any time, enter 'rs'
[nodemon] watching: *.*
[nodemon] starting 'node server.js'
internal/modules/cjs/loader.js:584
    throw err;
    ^

Error: Cannot find module 'bigchaindb-driver'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
    at Function.Module._load (internal/modules/cjs/loader.js:508:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/home/me/Desktop/nodeApp/server.js:14:14)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
[nodemon] app crashed - waiting for file changes before starting...

When I do an npm list in the folder, I get the following (snipped for readability)

$ npm list
nodeapp@1.0.0 /home/me/Desktop/nodeApp
├── acorn@6.1.1
├─┬ ajv@5.5.2
│ ├── co@4.6.0
│ ├── fast-deep-equal@1.1.0
│ ├── fast-json-stable-stringify@2.0.0
│ └── json-schema-traverse@0.3.1
├─┬ bigchaindb-driver@4.1.1
│ ├── browser-resolve@1.11.3 deduped
│ ├── bs58@4.0.1 deduped
│ ├── buffer@5.2.1 deduped
│ ├── clone@2.1.2 deduped
│ ├── core-js@2.6.5
│ ├── crypto-conditions@2.0.3 deduped
│ ├── decamelize@3.2.0 deduped
│ ├── es6-promise@4.2.6 deduped
│ ├── fetch-ponyfill@6.0.2 deduped
│ ├── isomorphic-fetch@2.2.1 deduped
│ ├── js-sha3@0.8.0 deduped
│ ├── js-utility-belt@1.5.0 deduped
│ ├── json-stable-stringify@1.0.1 deduped
│ ├── query-string@6.5.0 deduped
│ ├── rewire@4.0.1 deduped
│ ├── sprintf-js@1.1.2 deduped
│ ├── tweetnacl@1.0.1
│ ├── uglifyjs-webpack-plugin@2.1.2 deduped
│ ├── webpack-merge@4.2.1 deduped
│ └── webpack-sources@1.3.0 deduped
├─┬ browser-resolve@1.11.3
│ └── resolve@1.1.7
├─┬ bs58@4.0.1
│ └─┬ base-x@3.0.5
│   └── safe-buffer@5.1.2 deduped
├─┬ buffer@5.2.1
│ ├── base64-js@1.3.0
│ └── ieee754@1.1.13
├── clone@2.1.2
...<snipped for readability>

Any help would be welcome!

amitchhangani commented 5 years ago

Was facing the same issue, so installed an older version of the module, using below command, and it worked. npm install --save bigchaindb-driver@4.0

DawgVonT commented 5 years ago

Was facing the same issue, so installed an older version of the module, using below command, and it worked. npm install --save bigchaindb-driver@4.0

That indeed solved the issue. Not I'm heading into other issues tho. Thanks for the help!

amitchhangani commented 5 years ago

I think there will be an issue around "mnemonicToSeed" function, for that you will have to use mnemonicToSeedSync function in place of that. Also, you will have to update the module base-x. and the change you will have to do will be in "node_modules/base-x/index.js", comment out line number 29, and then it will work.

Thanks

kremalicious commented 5 years ago

Same issue here, current v4.1.1 package has been published insufficiently, see #292.

For now, installing the former version works:

npm i bigchaindb-driver@4.1.0
AnthonyPierrat commented 5 years ago

Hello,

I'm facing the same error "module not found error" while importing bigchaindb-driver. I tried above solutions but it's not working.

Any information about this error ? I tried many versions

Thanks

DawgVonT commented 5 years ago

Hello,

I'm facing the same error "module not found error" while importing bigchaindb-driver. I tried above solutions but it's not working.

Any information about this error ? I tried many versions

Thanks

Hi Anthony,

The answer from @kremalicious did work for me. I completely reinstalled Node (along with NPM), and tried again.

kr.

AnthonyPierrat commented 5 years ago

Hi thank you for you answer:)

I reinstalled everything from scratch (node, npm, driver) and i'm still facing the issue.

I have few errors while installing the driver about method deprecation with toObject

kr

DawgVonT commented 5 years ago

Have you tried using the --unsafe parameter whilst installing using npm? It might not be ideal, but maybe it will get you further in your search.

kr

kremalicious commented 4 years ago

that's fixed with the latest v4.1.2