dashevo / js-dash-sdk

DEPRECATED Dash client-side library for wallet payment/signing and application development. (Wallet, DAPI, Primitives, BLS, ...)
https://dashevo.github.io/platform/SDK/
MIT License
35 stars 21 forks source link

Trouble with const Dash = require('dash'); #254

Closed Santiago-R closed 2 years ago

Santiago-R commented 3 years ago

Trying to use the Dash SDK, I run into trouble at the very start. There is probably something really obvious I'm doing wrong...

Execution of const Dash = require('dash'); throws the following error:

Exception has occurred: Error: The gRPC binary module was not installed. This may be fixed by running "npm rebuild"
Original error: Cannot find module 'c:\Users\(...)\node_modules\grpc\src\node\extension_binary\node-v93-win32-x64-unknown\grpc_node.node'
Require stack:
- C:\Users\(...)\node_modules\grpc\src\grpc_extension.js
- C:\Users\(...)\node_modules\grpc\src\client_interceptors.js
- C:\Users\(...)\node_modules\grpc\src\client.js
- C:\Users\(...)\node_modules\grpc\index.js
- C:\Users\(...)\node_modules\@dashevo\dapi-grpc\clients\core\v0\nodejs\CorePromiseClient.js 
- C:\Users\(...)\node_modules\@dashevo\dapi-grpc\node.js
- C:\Users\(...)\node_modules\@dashevo\dapi-client\lib\methods\core\broadcastTransactionFactory.js
- C:\Users\(...)\node_modules\@dashevo\dapi-client\lib\methods\core\CoreMethodsFacade.js     
- C:\Users\(...)\node_modules\@dashevo\dapi-client\lib\DAPIClient.js
- C:\Users\(...)\node_modules\@dashevo\wallet-lib\src\transport\createTransportFromOptions.js
- C:\Users\(...)\node_modules\@dashevo\wallet-lib\src\types\Wallet\Wallet.js
- C:\Users\(...)\node_modules\@dashevo\wallet-lib\src\index.js
- C:\Users\(...)\node_modules\dash\build\src\SDK\Client\Client.js
- C:\Users\(...)\node_modules\dash\build\src\SDK\Client\index.js
- C:\Users\(...)\node_modules\dash\build\src\SDK\SDK.js
- C:\Users\(...)\node_modules\dash\build\src\SDK\index.js
- C:\Users\(...)\node_modules\dash\build\src\index.js
- C:\Users\(...)\connect.js
    at Object.<anonymous> (C:\Users\(...)\node_modules\grpc\src\grpc_extension.js:43:17)     
    at Module._compile (node:internal/modules/cjs/loader:1109:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
    at Module.load (node:internal/modules/cjs/loader:989:32)
    at Function.Module._load (node:internal/modules/cjs/loader:829:14)
    at Module.require (node:internal/modules/cjs/loader:1013:19)
    at require (node:internal/modules/cjs/helpers:93:18)
    at Object.<anonymous> (C:\Users\(...)\node_modules\grpc\src\client_interceptors.js:144:12)
    at Module._compile (node:internal/modules/cjs/loader:1109:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10) {
  code: 'MODULE_NOT_FOUND'
}

npm rebuild doesn't fix it, and re-installing grpc doesn't seem to either.

--

Node version: v16.2.0

Installed (npm ls): └── dash@3.20.3 And after re-installing grpc (same error occurs): └── dash@3.20.3 └── grpc@1.24.11

--

The original installation log for npm install dash:

npm WARN deprecated grpc@1.24.11: This library will not receive further updates other than security fixes. We recommend using @grpc/grpc-js instead.

added 283 packages, and audited 284 packages in 2m

19 packages are looking for funding
  run `npm fund` for details

6 moderate severity vulnerabilities

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

I tried the following too, none of which made a difference: npm audit fix npm audit fix --force npm install @grpc/grpc-js

Alex-Werner commented 3 years ago

With nvm use 16.2.0, with a npm install dash, I wasn't able to reproduce the issue. However I'm using OS X. @jawid-h, could you look at this under windows ? @Santiago-R could you confirm doing a fresh npm install that you indeed have that problem still today ?

jawid-h commented 3 years ago

@Alex-Werner sure, I'll try to reproduce it.

shumkov commented 3 years ago

In v0.21 we replaced the native grpc module with @grpc/grpc-js which is pure JS implementation so this issue will disappear when v0.21 will be released.

dashameter commented 3 years ago

test passed :+1:

SamKirby22 commented 2 years ago

Thanks. Closed

Santiago-R commented 2 years ago

I can confirm the issue is resolved as of v0.21, thanks a lot!!