Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

node js ipfs on windows #861

Closed
nezzard opened this issue May 22, 2017 · 30 comments
Closed

node js ipfs on windows #861

nezzard opened this issue May 22, 2017 · 30 comments
Labels
env:Windows exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws) P2 Medium: Good to have, but can wait until someone steps up

Comments

@nezzard
Copy link

nezzard commented May 22, 2017

Hi, i'm tried to install ipfs from npm on windows 10, but i always get an errors. So i have question, can i install ipfs on windows, or it's only for linux?

@victorb
Copy link
Member

victorb commented May 22, 2017

Don't think there is something that should stop it from working, but not sure how well tested js-ipfs is on windows. It'll help a lot of you post a full log of the errors and also the output from npm version

@nezzard
Copy link
Author

nezzard commented May 22, 2017

npm: '3.10.10', ares: '1.10.1-DEV', http_parser: '2.7.0', icu: '58.2', modules: '48', node: '6.10.3', openssl: '1.0.2k', uv: '1.9.1', v8: '5.1.281.101', zlib: '1.2.11' }

And npm install log
https://pastebin.com/r87NqUHe

And
jsipfs --help C:\Users\Yura\AppData\Roaming\npm\node_modules\ipfs\node_modules\ipld-resolver\node_modules\interface-datastore\src\key.js:42 throw new Error(Invalid key: ${this.toString()}`)
^

Error: Invalid key: \SHARDING
at new Key (C:\Users\Yura\AppData\Roaming\npm\node_modules\ipfs\node_modules\ipld-resolver\node_modules\interface-datastore\src\key.js:42:13)
at Object. (C:\Users\Yura\AppData\Roaming\npm\node_modules\ipfs\node_modules\ipld-resolver\node_modules\datastore-core\src\sharding.js:12:18)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (C:\Users\Yura\AppData\Roaming\npm\node_modules\ipfs\node_modules\ipld-resolver\node_modules\datastore-core\src\index.js:5:27)`

@daviddias
Copy link
Member

Hi @nezzard, thanks for reporting. This is a known issue with some proposed PR changes:

Wanna help us fix this issue? I need to get a Windows VM set up and won't have fast enough connectivity this week to download the full image.

@daviddias daviddias added the kind/bug A bug in existing code (including security flaws) label May 23, 2017
@nezzard
Copy link
Author

nezzard commented May 23, 2017

I tried to make fix from ipfs/interface-datastore#5 but nothing work, i have the same error like before

@mkg20001
Copy link
Contributor

mkg20001 commented May 26, 2017

Wanna help us fix this issue? I need to get a Windows VM set up and won't have fast enough connectivity this week to download the full image.

Or you can try https://www.appveyor.com/

@daviddias
Copy link
Member

There has been a fixed pushed, merged and released for interface-datastore. Could you confirm if this works now for you?

@nezzard
Copy link
Author

nezzard commented Jun 3, 2017

Just npm install ipfs?
If yes, it's not working

@daviddias
Copy link
Member

Oh, that is because I never released the new interface-datastore, shame on me. Try again now :)

@nezzard
Copy link
Author

nezzard commented Jun 3, 2017

Did npm uninstall ipfs than install and now get the same error Invalid key: \SHARDING

@daviddias daviddias changed the title node js ipfs on windows Running js-ipfs on Windows with Node.js Jun 3, 2017
@download13
Copy link

Hey, I'd really like to help get js-ipfs running on windows.

To that end I made a pull request to update the dependency of a dependency of this project: ipld/js-ipld#83

Once that's merged and published the dependency version on here can be updated and we can start looking at whatever the next windows-related bug will be.

@daviddias
Copy link
Member

@download13 which version of npm are you using? You shouldn't have this issue since interface-datastore was published as a patch version and ipld-resolver is using semver for that dep.

Could you try doing a fresh npm install on this repo?

@download13
Copy link

I tried it just now. Still getting

Error: Invalid key: \SHARDING
    at new Key (C:\Users\download\Desktop\js-ipfs\node_modules\datastore-core\node_modules\interface-datastore\src\key.js:42:13)
    at Object.<anonymous> (C:\Users\download\Desktop\js-ipfs\node_modules\datastore-core\src\sharding.js:12:18)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\download\Desktop\js-ipfs\node_modules\datastore-core\src\index.js:5:27)

@download13
Copy link

Isn't this using a package-lock.json file? I thought you had to update them somehow as the dependencies specified there will always be installed.

@daviddias
Copy link
Member

Which version of npm are you using?

@download13
Copy link

5.0.3

I tried directly replacing [email protected] with 0.2.2 in the package-lock.json file.

It turns out datastore-fs and datastore-core both depend on an old version of interface-datastore (0.1.1) so I swapped those out for the new entry as well.

Now the interface-datastore package seems to work fine, but it's giving the following error when I try to build:

Error: Cannot find module 'catbox-memory'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\download\code\open_source\js-ipfs\node_modules\hapi\lib\server.js:6:22)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)

Which doesn't make a lot of sense as I checked that catbox-memory does exist in both the package-lock.json file and in the ./node_modules/hapi/node_modules directory,

@daviddias
Copy link
Member

@download13 that is npm 5 doing its thing, you can delete the local cache or just simply delete the package-lock.json for now.

@nezzard
Copy link
Author

nezzard commented Jun 12, 2017

I still get the same error

@daviddias daviddias added the status/deferred Conscious decision to pause or backlog label Jul 3, 2017
@yaananth
Copy link

yaananth commented Jul 25, 2017

+1
npm version 5.3.0

> const IPFS = require('ipfs')
Error: Invalid key: \SHARDING
    at new Key (E:\test\node_modules\datastore-core\node_modules\interface-datastore\src\key.js:42:13)
    at Object.<anonymous> (E:\test\node_modules\datastore-core\src\sharding.js:12:18)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (E:\test\node_modules\datastore-core\src\index.js:5:27)

from package-lock.json

"ipfs": {
      "version": "https://registry.npmjs.org/ipfs/-/ipfs-0.25.0.tgz",
      "integrity": "sha1-k1/S3eJjyqXt46rTA2SqmU+mXUI=",
      "requires": {
         ...
        "ipfs-repo": "https://registry.npmjs.org/ipfs-repo/-/ipfs-repo-0.15.0.tgz",

But,
https:/ipfs/js-ipfs/blob/master/package.json
has "ipfs-repo": "~0.17.0", for "0.25.0"
(not sure why?)
I think 0.17.0 should fix it, since https:/ipfs/js-ipfs-repo/blob/0cb46d8896d80977fdcecc3217ece33b1b9ec953/package.json users datastore-fs that uses https:/ipfs/js-datastore-fs/blob/master/package.json 0.3.0 version of interface-datastore

@yaananth
Copy link

bump in ipfs-repo happened just two days ago
bc8ffee

@daviddias
Copy link
Member

@yaananth could you try running directly from the repo?

> git clone https:/ipfs/js-ipfs
> cd js-ipfs
> npm install
# then try one of the examples

@yaananth
Copy link

I guess so, atleast I didn't get that SHARDING error

 MINGW64 /d/Github Repositories/js-ipfs/examples/basics (master)
$ node index.js
D:\Github Repositories\js-ipfs\node_modules\mkdirp\index.js:90
                    throw err0;
                    ^

Error: EEXIST: file already exists, mkdir 'C:\Users\testUser\AppData\Local\Temp'
    at Object.fs.mkdirSync (fs.js:891:18)
    at sync (D:\Github Repositories\js-ipfs\node_modules\mkdirp\index.js:71:13)
    at sync (D:\Github Repositories\js-ipfs\node_modules\mkdirp\index.js:77:24)
    at sync (D:\Github Repositories\js-ipfs\node_modules\mkdirp\index.js:78:17)
    at sync (D:\Github Repositories\js-ipfs\node_modules\mkdirp\index.js:78:17)
    at sync (D:\Github Repositories\js-ipfs\node_modules\mkdirp\index.js:78:17)
    at sync (D:\Github Repositories\js-ipfs\node_modules\mkdirp\index.js:78:17)
    at sync (D:\Github Repositories\js-ipfs\node_modules\mkdirp\index.js:78:17)
    at sync (D:\Github Repositories\js-ipfs\node_modules\mkdirp\index.js:78:17)
    at sync (D:\Github Repositories\js-ipfs\node_modules\mkdirp\index.js:78:17)

@nezzard
Copy link
Author

nezzard commented Aug 13, 2017

throw new Error(Invalid key: ${this.toString()}`)
^

Error: Invalid key: /CIQFX22I3H5YK5MYQ4PI63M2UKZVJOP5K63QSXHXEIWE4GSQ6LC4UMQ
at new Key (C:\ipfs\node_modules\interface-datastore\src\key.js:45:13)
at keyFromBuffer (C:\ipfs\node_modules\ipfs-repo\src\blockstore.js:20:10)
at cidToDsKey (C:\ipfs\node_modules\ipfs-repo\src\blockstore.js:30:10)
at Object.has (C:\ipfs\node_modules\ipfs-repo\src\blockstore.js:129:17)
at waterfall (C:\ipfs\node_modules\ipfs-bitswap\src\index.js:237:31)
at nextTask (C:\ipfs\node_modules\async\waterfall.js:16:14)
at exports.default (C:\ipfs\node_modules\async\waterfall.js:26:5)
at Bitswap.put (C:\ipfs\node_modules\ipfs-bitswap\src\index.js:236:5)
at BlockService.put (C:\ipfs\node_modules\ipfs-block-service\src\index.js:61:28)
at waterfall (C:\ipfs\node_modules\ipld-resolver\src\index.js:351:28)`

@daviddias daviddias changed the title Running js-ipfs on Windows with Node.js Windows support Sep 1, 2017
@daviddias daviddias added exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue labels Sep 12, 2017
@daviddias daviddias changed the title Windows support node js ipfs on windows Sep 13, 2017
@daviddias
Copy link
Member

daviddias commented Sep 13, 2017

@download13
Copy link

Just to make sure, these keys are only over used on one computer, correct?

I mean, a key isn't constructed on one machine, then sent to another machine.

@daviddias
Copy link
Member

@download13 correct. Key is used as the path and it is only known to the repo.

@download13
Copy link

@diasdavid So repos are not intended to be moved between machines? In that case is there a way to import/export all the important data in a repository? I know about the ipfs key commands, but can you easily bring over pinned hashes/ipns bindings/etc?

Sorry that's a little off topic, it just seems like something to consider if you can't assume a repo created on one machine will work on another.

@daviddias
Copy link
Member

daviddias commented Sep 14, 2017

@download13 a repo from a machine should be usable on another machine.

ipfs key is not related to Repo keys. an IPFS Repo uses internally multiple instances of storage drivers that use interface-datastore which is an interface for a key value store, the key in IPFS Repo comes from Key Value Store

@download13
Copy link

@diasdavid So if I wanted to move a repo from a windows computer over to a linux vps, I'd be outta luck?

@daviddias
Copy link
Member

daviddias commented Sep 14, 2017

@download13 you work out of the box. A repo is just a bunch of files and paths

@daviddias daviddias added status/ready Ready to be worked P2 Medium: Good to have, but can wait until someone steps up and removed status/deferred Conscious decision to pause or backlog labels Oct 13, 2017
@daviddias
Copy link
Member

Windows support is here! Celebrate with us at #1017 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
env:Windows exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws) P2 Medium: Good to have, but can wait until someone steps up
Projects
None yet
Development

No branches or pull requests

6 participants