ipfs / js-ipfs

IPFS implementation in JavaScript
https://js.ipfs.tech
Other
7.44k stars 1.25k forks source link

node js ipfs on windows #861

Closed nezzard closed 7 years ago

nezzard commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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.

nezzard commented 7 years ago

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

mkg20001 commented 7 years ago

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 commented 7 years ago

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

nezzard commented 7 years ago

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

daviddias commented 7 years ago

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

nezzard commented 7 years ago

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

download13 commented 7 years ago

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: https://github.com/ipld/js-ipld-resolver/pull/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 commented 7 years ago

@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 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

Which version of npm are you using?

download13 commented 7 years ago

5.0.3

I tried directly replacing interface-datastore@0.2.1 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 commented 7 years ago

@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 commented 7 years ago

I still get the same error

yaananth commented 7 years ago

+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://github.com/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://github.com/ipfs/js-ipfs-repo/blob/0cb46d8896d80977fdcecc3217ece33b1b9ec953/package.json users datastore-fs that uses https://github.com/ipfs/js-datastore-fs/blob/master/package.json 0.3.0 version of interface-datastore

yaananth commented 7 years ago

bump inipfs-repo happened just two days ago https://github.com/ipfs/js-ipfs/commit/bc8ffee85c9468813278e0d2f5890c0c3d5f2678

daviddias commented 7 years ago

@yaananth could you try running directly from the repo?

> git clone https://github.com/ipfs/js-ipfs
> cd js-ipfs
> npm install
# then try one of the examples
yaananth commented 7 years ago

I guess so, atleast I didn't get that SHARDINGerror

 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 commented 7 years ago

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 commented 7 years ago

Windows Support main issue

download13 commented 7 years ago

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 commented 7 years ago

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

download13 commented 7 years ago

@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 commented 7 years ago

@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 commented 7 years ago

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

daviddias commented 7 years ago

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

daviddias commented 7 years ago

Windows support is here! Celebrate with us at https://github.com/ipfs/js-ipfs/issues/1017#issuecomment-343568369