Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Running on Windows #623

Closed
richardschneider opened this issue Nov 12, 2017 · 13 comments
Closed

Running on Windows #623

richardschneider opened this issue Nov 12, 2017 · 13 comments

Comments

@richardschneider
Copy link
Contributor

richardschneider commented Nov 12, 2017

The tests do not run on windows.

C:\Users\Owner\Documents\GitHub\js-ipfs-api>npm run test:node

> ipfs-api@15.0.1 test:node C:\Users\Owner\Documents\GitHub\js-ipfs-api
> aegir test --target node --no-parallel

Test Node.js
Warning: Could not find any test files matching pattern: test\node.js


  .add (extra tests)
C:\Users\Owner\Documents\GitHub\js-ipfs-api\test\ipfs-factory\server-routes.js:20
        throw err
        ^

Error: events.js:182
      throw er; // Unhandled 'error' event
      ^

Error: spawn C:\Users\Owner\Documents\GitHub\js-ipfs-api\node_modules\ipfsd-ctl\node_modules\go-ipfs-dep\go-ipfs\ipfs 
ENOENT
    at _errnoException (util.js:1024:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:192:19)
    at onErrorNT (internal/child_process.js:374:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
    at Function.Module.runMain (module.js:655:11)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3

    at Object.done (C:\Users\Owner\Documents\GitHub\js-ipfs-api\node_modules\ipfsd-ctl\src\exec.js:23:27)
    at Stream.listeners.done.once (C:\Users\Owner\Documents\GitHub\js-ipfs-api\node_modules\ipfsd-ctl\src\exec.js:45:18)
    at Stream.f (C:\Users\Owner\Documents\GitHub\js-ipfs-api\node_modules\once\once.js:25:25)
    at emitOne (events.js:115:13)
    at Stream.emit (events.js:210:7)
    at Socket.reemit (C:\Users\Owner\Documents\GitHub\js-ipfs-api\node_modules\duplexer\index.js:70:25)
    at emitOne (events.js:120:20)
    at Socket.emit (events.js:210:7)
    at Pipe._handle.close [as _onclose] (net.js:557:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ipfs-api@15.0.1 test:node: `aegir test --target node --no-parallel`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ipfs-api@15.0.1 test:node script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Owner\AppData\Roaming\npm-cache\_logs\2017-11-12T07_25_33_552Z-debug.log

C:\Users\Owner\Documents\GitHub\js-ipfs-api>    1) "before all" hook

lots more of failed tests with "before all"

@richardschneider
Copy link
Contributor Author

richardschneider commented Nov 12, 2017

Issues that i can see

  • ENOENT from ipfsd-ctl. Its trying to run ...\ipfs but on Windows it should be ...\ipfs.exe.
  • Tests are generating output after the npm/aegir is done!

@thisconnect
Copy link

@richardschneider good you could reproduce that, I had a fix, but then couldn't really reproduce it anymore and CI passed without it. Also my windows pc burned down.

please have a look https://github.com/thisconnect/js-ipfsd-ctl/commit/03ea8d538e141aa2bafb2ace81771f948684c03d#diff-6ff379484cbabad48301d485db111c08R31

@richardschneider
Copy link
Contributor Author

richardschneider commented Nov 12, 2017

@thisconnect I've just spent 2 hours debugging this. It looks like windows is happy without the .exe!

It appears to be NPM. We are trying to spawn <blah>\js-ipfs-api\node_modules\ipfsd-ctl\node_modules\go-ipfs-dep\go-ipfs\ipfs . But node_modules\ipfsd-ctl\node_modules does not exist.

I think the new NPM moves all "sub node_modules" to the top-level node_modules. Just read about folder parsimony

How it works on *nix, I have no idea. Perhaps symlinks.

@thisconnect
Copy link

well since npm3 NPM tries to deduplicate everything, that is why there is still some npm2 code https://github.com/ipfs/js-ipfsd-ctl/blob/master/src/daemon.js#L33 (which we probably could remove now)

You say it tries to spawn <blah>\js-ipfs-api\node_modules\ipfsd-ctl\node_modules\go-ipfs-dep\go-ipfs\ipfs, that looks like the npm2 path :/

Do you use a really old npm version?

@thisconnect
Copy link

So the try/catch npm3 path seems to fail for you https://github.com/ipfs/js-ipfsd-ctl/blob/master/src/daemon.js#L37 are you sure it is not because of .exe?

@richardschneider
Copy link
Contributor Author

Just read about folder parsimony. I'm running NPM 5.4.2, which is pretty current.

@richardschneider
Copy link
Contributor Author

@thisconnect You are good! spawning without .exe is okay for window, but the checking for the file without .exe fails.

@richardschneider
Copy link
Contributor Author

This is also explains why running the ipfsd-ctl test work on windows. It just falls back NPM 2 path, which is valid when working directly with the package.

@richardschneider
Copy link
Contributor Author

Just did a quick hack and its looks to be working!

If you are ever in NZ, I'll buy the beers.

You are awesome.

@richardschneider
Copy link
Contributor Author

With the new js-ipfsd-ctl, 254 passing, 12 pending and 18 failing tests.

The failures can be summarised as

  • diag.sys [Error: this operation is not supported on your platform]
  • dial attempt failed: context deadline exceeded
  • .swarm.addrs Uncaught AssertionError: expected [] not to be empty
  • .swarm.peers timeout
  • various issues with addFromFs
  • a few tests are getting different hash IDs

@daviddias
Copy link
Contributor

@richardschneider mind opening a PR on js-ipfs-api?

diag.sys [Error: this operation is not supported on your platform]

We can have a flag that disables this test for Windows, it's ok.

dial attempt failed: context deadline exceeded

Do you know what it was trying to dial to?

.swarm.addrs Uncaught AssertionError: expected [] not to be empty

Sounds like this failed due to the previous dial fail

.swarm.peers timeout

Increase the timeout?

various issues with addFromFs

Reported here #408

a few tests are getting different hash IDs

Weird, which ones?

@richardschneider
Copy link
Contributor Author

test-results.txt

@richardschneider
Copy link
Contributor Author

Transferred to PR #624

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants