josephg / node-foundationdb

Modern Node.js FoundationDB bindings
Other
115 stars 17 forks source link

Running on Window Subsystem for Linux #35

Closed endyjasmi closed 7 months ago

endyjasmi commented 4 years ago

I have installed FoundationDB 6.1.12 on my Windows 10 machine using the installer downloaded from Foundation Official Site.

Everything works if I am running the NodeJS process with Powershell but my main development environment is Window Subsystem for Linux (WSL), everytime I tried to npm install foundationdb, it errored out with the following log:

> foundationdb@0.10.3 install /c/Project/couchplus/monorepo/playground/foundationdb/node_modules/foundationdb
> node-gyp-build

make: Entering directory '/c/Project/couchplus/monorepo/playground/foundationdb/node_modules/foundationdb/build'
make: *** No rule to make target 'Release/obj.target/fdblib/src/module.o', needed by 'Release/obj.target/fdblib.node'.  Stop.
make: Leaving directory '/c/Project/couchplus/monorepo/playground/foundationdb/node_modules/foundationdb/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/c/Project/couchplus/monorepo/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:209:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.4.0-17134-Microsoft
gyp ERR! command "/home/endyjasmi/.nvm/versions/node/v12.9.1/bin/node" "/c/Project/couchplus/monorepo/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /c/Project/couchplus/monorepo/playground/foundationdb/node_modules/foundationdb
gyp ERR! node -v v12.9.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok 
npm WARN foundationdb No description
npm WARN foundationdb No repository field.
npm WARN foundationdb No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! foundationdb@0.10.3 install: `node-gyp-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the foundationdb@0.10.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I am not sure how to proceed from there. Any help would be greatly appreciated.

josephg commented 4 years ago

Hm I haven't seen that issue, but WSL isn't something I've been testing node-fdb against. Are you using the linux package or foundationdb for windows?

It should work ok using the linux package if you're in WSL, but I haven't tried it so I'm not too surprised that there's a configuration issue to sort out. It might be misdetecting wsl as windows or something like that.

endyjasmi commented 4 years ago

Hey, thanks for the prompt reply. I am currently using FoundationDB for windows.

After going through the documentation, my current thought is that as long as the client have access to fdb.cluster and also libfdb_c.so it should successfully install.

Assuming my thought are correct, the next question would be, where do I put those file under linux.

As a last resort, I am considering uninstall the FoundationDB for Windows and install the ubuntu version.

josephg commented 4 years ago

Yeah it should work fine using foundationdb for windows and the foundationdb client inside wfl. The easiest way to get that set up is to to install the foundationdb client library in linux, and like you've already done, copy over the fdb.cluster file so you can connect to the windows server from inside wfl. Assuming you're using ubuntu, the .deb package for the foundationdb client is on that downloads page you linked.

It should also work if you just install the libfdb_c.so. FDB searches for this in a few places - apparently the default place on linux is /usr/lib but you can set it up to look in some other locations too.

But yeah, try installing the client library inside WFL then re-installing the node foundationdb library. Let me know how it goes

endyjasmi commented 4 years ago

I tried downloading libfdb_c.so and put it inside /usr/lib. npm install works flawlessly, sadly any operation throws this;

[FDBError: Action not possible before the network is configured] {
  code: 2008
}
/c/Project/couchplus/monorepo/playground/foundationdb/node_modules/foundationdb/dist/lib/index.js:27
    process.on('exit', () => native_1.default.stopNetwork());
                                              ^

FDBError: Action not possible before the network is configured
    at process.<anonymous> (/c/Project/couchplus/monorepo/playground/foundationdb/node_modules/foundationdb/dist/lib/index.js:27:47)
    at process.emit (events.js:209:13) {
  code: 2008
}

Typing fdbcli --exec status in WSL bash yield ERROR: Disk i/o operation failed (1510). Further research and found https://forums.foundationdb.org/t/foundationdb-does-not-run-on-windows-subsystem-for-linux-wsl/809.

So, the conclusion would be FoundationDB DOES NOT run on Window Subsystem for Linux even the FoundationDB client.

So, for now I am stucked switching between Powershell and WSL Bash. Any other idea? If not maybe we can close this issues.

josephg commented 4 years ago

Sadly not. WSL2 should fix this issue when it arrives, so apparently fixing WSL compatibility isn't a high priority. This is also one of those issues that would be fixed with a standard wire protocol - which is under discussion at the moment.

So, sorry - no other solutions for now. Hopefully soon we can revisit this with some better answers.