Building on Windows 10

Hi I’ve just completed my first build of Joplin on Windows. Here’s a grab-bag of problems I encountered and my work-arounds. These problems were all self-inflicted and not flaws in Joplin itself.

My development environment:
os: Win 10
joplin v1.0.165
node: v10.16.2
npm: 6.9.0
windows-build-tools: 5.2.2
cli: mix of >powershell and $gitbash

I set myself up with the first problem by not following the standard build instructions and diving straight into the Windows build hints . The standard build instructions caution ‘Before building any of the applications, you need to build the tools’. Next time I would follow the standard build instructions until encountering a problem, then hit the Windows hints.

Building the Electron application - Problem #1

$ cd ElectronApp/app
$ npm install
...
Error: Cannot find module 'fs-extra'

Installing the Tools first fixes this.
Next try

$ npm install
...
An unhandled error occurred inside electron-rebuild
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python ",

For future flexibility I install Python with the excellent pyenv

$ npm install
...
An unhandled error occurred inside electron-rebuild
gyp ERR! configure error
gyp ERR! stack Error: Command failed:  .pyenv\pyenv-win\shims\python.BAT -c import sys; print("%s.%s.%s "% sys.version_info[:3]);

Unfortunately pyenv proxies the python executable through a batch file that struggles with cli scripts. So I find my actual python.exe and drop it into %PATH% one place ahead of pyenv.
progress…

$ npm install
...
error MSB3428: Could not load the Visual C++ component "VCBuild.exe ".  To fix this, 1) install the .NET Framework 2.0 SDK

I needed an additional parameter to the windows-build-tools install. Thank you stackoverflow . No, not just the --vs2015, but --production!

admin powershell
>npm --vs2015 install --global --production windows-build-tools

Closer now. It looks to have installed but

$ npm list --depth=0
Joplin@1.0.165 Joplin\src\joplin\ElectronClient\app
+-- UNMET OPTIONAL DEPENDENCY 7zip-bin-linux@1.3.1
+-- UNMET OPTIONAL DEPENDENCY 7zip-bin-mac@1.0.1
+-- 7zip-bin-win@2.2.0
...
npm ERR! peer dep missing: ajv@^6.9.1, required by ajv-keywords@3.4.0

Hmmm, a dependency doesn’t like Windows. Yes it does, it made friends in a later version .

$ npm uninstall ajv
$ npm install ajv@6.10.2 --save

Next stop, build happiness.

1 Like