Skip to content

Problems running examples #14

Open
@cowlicks

Description

@cowlicks

I tried to walk through the examples section , on both master and the v10 branch. Following the code I had a few problems:

  • after running npm install the node examples-nodejs/run.js hypercore failed ( same with running node examples-nodejs-v10/run.js on the v10 branch). I got this error:
➜  hypercore-protocol-rs git:(master) ✗ node examples-nodejs/run.js hypercore 
[
  '/usr/bin/node',
  '/<redacted>/hypercore-protocol-rs/examples-nodejs/run.js',
  'hypercore'
]
[node] spawn: node /<redacted>/hypercore-protocol-rs/README.md
[node] node:internal/validators:177
[node]     throw new ERR_INVALID_ARG_TYPE(name, 'number', value);
[node]     ^
[node] 
[node] TypeError [ERR_INVALID_ARG_TYPE]: The "size" argument must be of type number. Received undefined
[node]     at Function.alloc (node:buffer:401:3)
[node]     at ProtocolHandshake.keyPair (/<redacted>/hypercore-protocol-rs/examples-nodejs/node_modules/simple-hypercore-protocol/lib/handshake.js:67:25)
[node]     at SimpleProtocol.keyPair (/<redacted>/hypercore-protocol-rs/examples-nodejs/node_modules/simple-hypercore-protocol/index.js:234:22)
[node]     at ProtocolStream.keyPair (/<redacted>/hypercore-protocol-rs/examples-nodejs/node_modules/hypercore-protocol/index.js:398:16)
[node]     at new Feed (/<redacted>/hypercore-protocol-rs/examples-nodejs/node_modules/hypercore/index.js:74:53)
[node]     at Feed (/<redacted>/hypercore-protocol-rs/examples-nodejs/node_modules/hypercore/index.js:54:39)
[node]     at Object.<anonymous> (/<redacted>/hypercore-protocol-rs/examples-nodejs/replicate.js:25:14)
[node]     at Module._compile (node:internal/modules/cjs/loader:1233:14)
[node]     at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
[node]     at Module.load (node:internal/modules/cjs/loader:1091:32) {
[node]   code: 'ERR_INVALID_ARG_TYPE'
[node] }
[node] 
[node] Node.js v20.4.0
  • So instead I tried to run the rust example directly with cargo run --exapmple hypercore. I get this error:
➜  hypercore-protocol-rs git:(master) ✗ cargo run --example hypercore
    Updating crates.io index
    Updating git repository `https://github.com/datrs/hypercore`
error: failed to select a version for the requirement `aes = "^0.3"`
candidate versions found which didn't match: 0.8.3, 0.8.2, 0.8.1, ...
location searched: crates.io index
required by package `aes-gcm v0.5.0`
    ... which satisfies dependency `aes-gcm = "^0.5"` of package `snow v0.7.0-alpha5`
    ... which satisfies dependency `snow = "^0.7.0-alpha5"` of package `hypercore-protocol v0.3.1 (/<redacted>/hypercore-protocol-rs)`
perhaps a crate was updated and forgotten to be re-vendored?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions