Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support / documentation for Windows #105

yusefnapora opened this issue Nov 28, 2016 · 1 comment

Support / documentation for Windows #105

yusefnapora opened this issue Nov 28, 2016 · 1 comment


Copy link

@yusefnapora yusefnapora commented Nov 28, 2016

At minimum, we should document setting up and using the Windows Subsystem for Linux, but I'd also like to support "real" Windows. This is unfortunately a fairly big hassle, since node-gyp and Windows don't get along as well as they could, and running node on Windows is kind of awkward at the best of times. Or maybe I'm just out of touch with the platform, so things feel harder than they should 😄

Notes on the Linux/windows install:

  • Enable WSL - all following instructions are run from inside bash
  • Install dependencies: apt-get install build-essential g++ libssl-dev git
  • Install node: curl -sL | bash, then apt-get install nodejs
  • Install aleph: sudo npm install -g aleph (takes a while... it helps to add the -d flag to get verbose output)

Here's what I've been able to piece together so far for the "real Windows" install on a Windows 10 VM:

Install C++ build tools:
Installation method depends on whether you have Visual Studio installed, although hopefully that will be fixed soon, and we can just recommend everyone use the windows-build-tools package.

If you do have Visual Studio, you need to ensure that you've installed the Common Tools for Visual C++. You can either re-run the installer, or open VS and try to create a new C++ project that targets Windows, which will open the installer for you. Make sure the box for the Common Tools for Visual C++ is checked. After the installation, open a Command Prompt or Git Bash and run npm config set msvs_version 2015

If you do not have Visual Studio installed, open a Command Prompt (or Git Bash) as an Administrator and run npm install -g --production windows-build-tools.

  • try to install aleph:
    • global installation seems to choke with a bunch of git errors; this can probably be resolved by running in an elevated shell, but for now I'm just trying to install to a local node_modules dir.
    • die trying to install node-webcrypto-ossl
    • probably die trying to build jq
Copy link
Contributor Author

@yusefnapora yusefnapora commented Nov 29, 2016

So, I managed to get aleph to install on windows (outside of the linux subsystem) with some gross hacks, mostly related to building node-webcrypto-ossl.

Building node-webcrypto-ossl required downloading a 64-bit binary OpenSSL 1.0.2 package from here, installing it to c:\OpenSSL-Win64, then copying files from the installed location to a new folder. At a cmd.exe prompt in some working dir (e.g. c:\Users\yusef\test):

  • make the directory structure node-webcrypto-ossl expects
    • md openssl\out32dll
  • copy openssl headers
    • xcopy /S /I c:\OpenSSL-Win64\include openssl\inc32
  • copy the static openssl lib we need to the place node-webcrypto-ossl will look for it
    • copy c:\OpenSSL-Win64\lib\VC\libeay32MTd.lib openssl\out32dll\libeay32.lib
  • resolve a build failure caused by tsc not being on the PATH
    • npm install -g typescript
  • install node-webcrypto-ossl, overriding the node-gyp variable openssl_root to point to the directory we setup (the %cd% expands to the absolute path of the current dir, like $PWD on unix)
    • npm install node-webcrypto-ossl --openssl_root=%cd%\openssl

Once I figured that out, I was able to clone aleph and build it with a couple changes:

  • download windows jq binary and stick it in ./bin to keep build-jq.js from choking (need to fix this)
  • change the build script in package.json from mkdir -p ./lib && babel --copy-files src -d lib to mkdirp ./lib && babel --copy-files src -d lib, which uses the (already installed) npm mkdirp tool instead of mkdir, since mkdir doesn't understand the -p flag on Windows.
  • delete the npm-shrinkwrap.json file (weird git error, not sure what's up there)
  • create the openssl dir as above
  • run npm install --openssl_root=<absolute-path-to-openssl-dir>

Then I could run npm link, and finally this (with concat running locally in WSL bash):

C:\Users\yusef\test\aleph>mcclient id
Peer ID: QmbVHyoG9AqNUaCpDXpph5RNsJY5e65MCHE5N5Pt1yzyDi
Publisher ID: 4XTTM8R4MRbqKKfGTWGinn5cAmrqjZ44VW6wJSZLF1d2n3MVR

All of this is to say that Windows support doesn't require that many changes, apart from the webcrypto stuff. If / when that gets fixed, we should be able to support real Windows without too much fuss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.