Attempting to build on Windows

Not something I can say I was keen to really try but without an easy way to build windows applications on Linux I wasn't really sure I had a choice.

I have had a few issues that might be related to documentation or might be for my environment.
Bare in mind that I've started from a totally blank slate here, no node or vs tools of any kind previously installed.

I did however had a few issues installing node.js (16.13.1 LTS) where it kept just hanging installing some of the microsoft packages. In the end it seems like it has installed.

So working through the build guide I hit a few snags:

Windows: Install Windows Build Tools - yarn install -g windows-build-tools --vs2015

This failed in two ways:

  1. yarn wasn't recognised. Although available and installed with corepack with npm it seems you have to run corepack enable unless you are on 17+
  2. When corepack is enabled you get the following:
PS> yarn install -g windows-build-tools --vs2015
yarn install v1.22.15
error `--global` has been deprecated. Please run "yarn global add windows-build-tools" instead.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Following the advice given:

PS> yarn global add windows-build-tools --vs2015
yarn global v1.22.15
[1/4] Resolving packages...
warning windows-build-tools@5.2.2: Node.js now includes build tools for Windows. You probably no longer need this tool. See https://github.com/felixrieseberg/windows-build-tools for details.
warning windows-build-tools > nugget > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning windows-build-tools > nugget > request > har-validator@5.1.5: this library is no longer supported
warning windows-build-tools > nugget > request > uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[1/1] ⠠ windows-build-tools

Just gets stuck in some kind of infinite loop where it doesn't actually seem to finish doing anything after 10 mins.

Going off the info in the log suggesting that Node.js already includes build tools for windows I attempted to continue:

PS C:\users\name\jopclone\joplin> yarn install
➤ YN0000: ┌ Resolution step
➤ YN0002: │ @aws-sdk/client-s3@npm:3.44.0 doesn't provide @aws-sdk/signature-v4-crt (p6155d), requested by @aws-sdk/middleware-sdk-s3
➤ YN0002: │ @aws-sdk/s3-request-presigner@npm:3.44.0 doesn't provide @aws-sdk/signature-v4-crt (pf5946), requested by @aws-sdk/middleware-sdk-s3
➤ YN0060: │ @joplin/app-desktop@workspace:packages/app-desktop provides react (p420ff) with version 16.13.1, which doesn't satisfy what react-test-renderer requests
➤ YN0060: │ @joplin/app-desktop@workspace:packages/app-desktop provides react-dom (p2e5b2) with version 16.9.0, which doesn't satisfy what re-resizable requests
➤ YN0002: │ @joplin/app-desktop@workspace:packages/app-desktop doesn't provide react-is (p0cdf0), requested by styled-components
➤ YN0060: │ @joplin/app-mobile@workspace:packages/app-mobile provides react (pb7acb) with version 17.0.2, which doesn't satisfy what react-redux requests
➤ YN0060: │ @joplin/app-mobile@workspace:packages/app-mobile provides react-native (pbf89e) with version 0.66.1, which doesn't satisfy what react-native-webview requests
➤ YN0002: │ @joplin/app-mobile@workspace:packages/app-mobile doesn't provide react-native-windows (pb66a5), requested by react-native-fs
➤ YN0002: │ @joplin/app-mobile@workspace:packages/app-mobile doesn't provide tslib (p1cc78), requested by @rollup/plugin-typescript
➤ YN0060: │ @joplin/fork-htmlparser2@workspace:packages/fork-htmlparser2 provides eslint (p4ecde) with version 6.8.0, which doesn't satisfy what @typescript-eslint/eslint-plugin and some of its descendants request
➤ YN0060: │ @joplin/fork-htmlparser2@workspace:packages/fork-htmlparser2 provides eslint (p83f76) with version 6.8.0, which doesn't satisfy what @typescript-eslint/parser requests
➤ YN0060: │ @joplin/fork-htmlparser2@workspace:packages/fork-htmlparser2 provides jest (pa940f) with version 26.6.3, which doesn't satisfy what ts-jest requests
➤ YN0060: │ @joplin/server@workspace:packages/server provides sqlite3 (p9ac44) with version 4.2.0, which doesn't satisfy what @rmp135/sql-ts and some of its descendants request
➤ YN0060: │ @joplin/server@workspace:packages/server provides sqlite3 (p05a2d) with version 4.2.0, which doesn't satisfy what knex requests
➤ YN0002: │ @octokit/rest@npm:16.43.2 doesn't provide @octokit/core (p84523), requested by @octokit/plugin-request-log
➤ YN0002: │ react-native-codegen@npm:0.0.7 doesn't provide @babel/preset-env (pe4ee6), requested by jscodeshift
➤ YN0060: │ root@workspace:. provides eslint (p2edfe) with version 7.32.0, which doesn't satisfy what eslint-plugin-react-hooks requests
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed in 0s 365ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ yeoman-generator@npm:2.0.5 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yeoman-generator@npm:4.13.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ ylru@npm:1.2.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yosay@npm:2.0.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ zxcvbn@npm:4.4.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0000: └ Completed in 6s 494ms
➤ YN0000: ┌ Link step
➤ YN0076: │ fsevents@patch:fsevents@npm%3A1.2.13#~builtin<compat/fsevents>::version=1.2.13&hash=18f3a7 The win32-x64 architecture is incompatible with this module, link skipped.
➤ YN0076: │ fsevents@patch:fsevents@npm%3A2.3.2#~builtin<compat/fsevents>::version=2.3.2&hash=18f3a7 The win32-x64 architecture is incompatible with this module, link skipped.
➤ YN0076: │ 7zip-bin-linux@npm:1.3.1 The win32-x64 architecture is incompatible with this module, link skipped.
➤ YN0076: │ 7zip-bin-mac@npm:1.0.1 The win32-x64 architecture is incompatible with this module, link skipped.
➤ YN0076: │ dmg-license@npm:1.0.10 The win32-x64 architecture is incompatible with this module, link skipped.
➤ YN0076: │ iconv-corefoundation@npm:1.1.7 The win32-x64 architecture is incompatible with this module, link skipped.
➤ YN0007: │ @joplin/app-clipper@workspace:packages/app-clipper must be built because it never has been before or the last one failed
➤ YN0007: │ husky@npm:3.1.0 must be built because it never has been before or the last one failed
➤ YN0007: │ nodemon@npm:2.0.15 must be built because it never has been before or the last one failed
➤ YN0007: │ keytar@npm:7.7.0 must be built because it never has been before or the last one failed
➤ YN0007: │ sharp@npm:0.26.3 must be built because it never has been before or the last one failed
➤ YN0007: │ sqlite3@npm:5.0.2 [ea905] must be built because it never has been before or the last one failed
➤ YN0007: │ core-js@npm:2.6.12 must be built because it never has been before or the last one failed
➤ YN0007: │ sharp@npm:0.25.4 must be built because it never has been before or the last one failed
➤ YN0007: │ @fortawesome/fontawesome-free@npm:5.15.4 must be built because it never has been before or the last one failed
➤ YN0007: │ electron@npm:14.1.0 must be built because it never has been before or the last one failed
➤ YN0007: │ lzma-native@npm:8.0.1 must be built because it never has been before or the last one failed
➤ YN0007: │ @fortawesome/fontawesome-common-types@npm:0.2.36 must be built because it never has been before or the last one failed
➤ YN0007: │ ejs@npm:2.7.4 must be built because it never has been before or the last one failed
➤ YN0007: │ sqlite3@npm:4.2.0 must be built because it never has been before or the last one failed
➤ YN0007: │ root@workspace:. must be built because it never has been before or the last one failed
➤ YN0007: │ @joplin/app-desktop@workspace:packages/app-desktop must be built because it never has been before or the last one failed
➤ YN0007: │ @joplin/app-mobile@workspace:packages/app-mobile must be built because it never has been before or the last one failed
➤ YN0007: │ @fortawesome/fontawesome-svg-core@npm:1.2.36 must be built because it never has been before or the last one failed
➤ YN0007: │ @fortawesome/free-regular-svg-icons@npm:5.15.4 must be built because it never has been before or the last one failed
➤ YN0007: │ @fortawesome/free-solid-svg-icons@npm:5.15.4 must be built because it never has been before or the last one failed
➤ YN0009: │ @joplin/app-desktop@workspace:packages/app-desktop couldn't be built successfully (exit code 1, logs can be found here: C:\Users\name\AppData\Local\Temp\xfs-fb7558f1\build.log)
➤ YN0009: │ root@workspace:. couldn't be built successfully (exit code 1, logs can be found here: C:\Users\name\AppData\Local\Temp\xfs-0fb54556\build.log)
➤ YN0000: └ Completed in 1m 56s
➤ YN0000: Failed with errors in 2m 3s

Log files generated:

# This file contains the result of Yarn building a package (@joplin/app-desktop@workspace:packages/app-desktop)
# Script name: postinstall

[e[90m14:17:12e[39m] Using gulpfile C:\users\name\jopclone\joplin\packages\app-desktop\gulpfile.js
[e[90m14:17:12e[39m] Starting 'build'...
[e[90m14:17:12e[39m] Starting 'compileScripts'...
[e[90m14:17:12e[39m] Starting 'compilePackageInfo'...
[e[90m14:17:12e[39m] Starting 'copyPluginAssets'...
[e[90m14:17:12e[39m] Starting 'copyApplicationAssets'...
[e[90m14:17:12e[39m] Starting 'updateIgnoredTypeScriptBuild'...
[e[90m14:17:12e[39m] Starting 'buildCommandIndex'...
[e[90m14:17:12e[39m] Starting 'compileSass'...
Compiling C:\users\name\jopclone\joplin\packages\app-desktop\tools/../gui/ExtensionBadge.jsx...

Error: spawnSync yarn ENOENT
    at Object.spawnSync (node:internal/child_process:1083:20)
    at spawnSync (node:child_process:812:24)
    at C:\users\name\jopclone\joplin\packages\app-desktop\tools\compileScripts.js:33:19
    at Array.forEach (<anonymous>)
    at convertJsx (C:\users\name\jopclone\joplin\packages\app-desktop\tools\compileScripts.js:19:23)
    at module.exports (C:\users\name\jopclone\joplin\packages\app-desktop\tools\compileScripts.js:47:2)
    at taskWrapper (C:\users\name\jopclone\joplin\packages\app-desktop\node_modules\undertaker\lib\set-task.js:13:15)
    at bound (node:domain:421:15)
    at runBound (node:domain:432:12)
    at asyncRunner (C:\users\name\jopclone\joplin\packages\app-desktop\node_modules\async-done\index.js:55:18) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawnSync yarn',
  path: 'yarn',
  spawnargs: [
    'run',
    'babel',
    '--presets',
    'react',
    '--out-file',
    'C:\\users\\name\\jopclone\\joplin\\packages\\app-desktop\\tools/../gui/ExtensionBadge.min.js',
    'C:\\users\\name\\jopclone\\joplin\\packages\\app-desktop\\tools/../gui/ExtensionBadge.jsx'
  ]
}
[e[90m14:17:12e[39m] The following tasks did not complete: build, compileScripts, compilePackageInfo, copyPluginAssets, copyApplicationAssets, updateIgnoredTypeScriptBuild, buildCommandIndex, compileSass
[e[90m14:17:12e[39m] Did you forget to signal async completion?
# This file contains the result of Yarn building a package (root@workspace:.)
# Script name: postinstall

➤ YN0000: [joplin]: Process started
➤ YN0000: [@joplin/app-desktop]: Process started
➤ YN0000: [@joplin/app-mobile]: Process started
➤ YN0000: [@joplin/fork-htmlparser2]: Process started
➤ YN0000: [@joplin/server]: Process started
➤ YN0000: [@joplin/turndown]: Process started
➤ YN0000: [@joplin/turndown]: 
➤ YN0000: [@joplin/turndown]: src/turndown.js → lib/turndown.cjs.js...
➤ YN0000: [@joplin/turndown]: created lib/turndown.cjs.js in 261ms
➤ YN0000: [@joplin/turndown]: Process exited (exit code 0), completed in 2s 788ms
➤ YN0000: [@joplin/turndown-plugin-gfm]: Process started
➤ YN0000: [joplin]: [e[90m14:17:16e[39m] Using gulpfile C:\users\name\jopclone\joplin\packages\app-cli\gulpfile.js
➤ YN0000: [joplin]: [e[90m14:17:16e[39m] Starting 'build'...
➤ YN0000: [joplin]: [e[90m14:17:16e[39m] Starting 'prepareBuild'...
➤ YN0000: [@joplin/app-mobile]: [e[90m14:17:16e[39m] Using gulpfile C:\users\name\jopclone\joplin\packages\app-mobile\gulpfile.js
➤ YN0000: [@joplin/app-mobile]: [e[90m14:17:16e[39m] Starting 'build'...
➤ YN0000: [@joplin/app-mobile]: [e[90m14:17:16e[39m] Starting 'buildInjectedJs'...
➤ YN0000: [@joplin/app-mobile]: Building CodeMirror bundle...
➤ YN0000: [@joplin/server]: [e[90m14:17:16e[39m] Using gulpfile C:\users\name\jopclone\joplin\packages\server\gulpfile.js
➤ YN0000: [@joplin/server]: [e[90m14:17:16e[39m] Starting 'build'...
➤ YN0000: [@joplin/server]: [e[90m14:17:16e[39m] Starting 'compilePackageInfo'...
➤ YN0000: [joplin]: [e[90m14:17:16e[39m] Finished 'prepareBuild' after 154 ms
➤ YN0000: [joplin]: [e[90m14:17:16e[39m] Finished 'build' after 156 ms
➤ YN0000: [@joplin/server]: Generated C:\users\name\jopclone\joplin\packages\server/dist/packageInfo.js
➤ YN0000: [@joplin/server]: [e[90m14:17:16e[39m] Finished 'compilePackageInfo' after 82 ms
➤ YN0000: [@joplin/server]: [e[90m14:17:16e[39m] Finished 'build' after 84 ms
➤ YN0000: [@joplin/app-desktop]: [e[90m14:17:16e[39m] Using gulpfile C:\users\name\jopclone\joplin\packages\app-desktop\gulpfile.js
➤ YN0000: [@joplin/app-desktop]: [e[90m14:17:16e[39m] Starting 'build'...
➤ YN0000: [@joplin/app-desktop]: [e[90m14:17:16e[39m] Starting 'compileScripts'...
➤ YN0000: [@joplin/app-desktop]: [e[90m14:17:16e[39m] Starting 'compilePackageInfo'...
➤ YN0000: [@joplin/app-desktop]: [e[90m14:17:16e[39m] Starting 'copyPluginAssets'...
➤ YN0000: [@joplin/app-desktop]: [e[90m14:17:16e[39m] Starting 'copyApplicationAssets'...
➤ YN0000: [@joplin/app-desktop]: [e[90m14:17:16e[39m] Starting 'updateIgnoredTypeScriptBuild'...
➤ YN0000: [@joplin/app-desktop]: [e[90m14:17:16e[39m] Starting 'buildCommandIndex'...
➤ YN0000: [@joplin/app-desktop]: [e[90m14:17:16e[39m] Starting 'compileSass'...
➤ YN0000: [@joplin/app-desktop]: Compiling C:\users\name\jopclone\joplin\packages\app-desktop\tools/../gui/ExtensionBadge.jsx...
➤ YN0000: [@joplin/app-desktop]: [e[90m14:17:16e[39m] The following tasks did not complete: build, compileScripts, compilePackageInfo, copyPluginAssets, copyApplicationAssets, updateIgnoredTypeScriptBuild, buildCommandIndex, compileSass
➤ YN0000: [@joplin/app-desktop]: [e[90m14:17:16e[39m] Did you forget to signal async completion?
➤ YN0000: [@joplin/app-desktop]: 
➤ YN0000: [@joplin/app-desktop]: Error: spawnSync yarn ENOENT
➤ YN0000: [@joplin/app-desktop]:     at Object.spawnSync (node:internal/child_process:1083:20)
➤ YN0000: [@joplin/app-desktop]:     at spawnSync (node:child_process:812:24)
➤ YN0000: [@joplin/app-desktop]:     at C:\users\name\jopclone\joplin\packages\app-desktop\tools\compileScripts.js:33:19
➤ YN0000: [@joplin/app-desktop]:     at Array.forEach (<anonymous>)
➤ YN0000: [@joplin/app-desktop]:     at convertJsx (C:\users\name\jopclone\joplin\packages\app-desktop\tools\compileScripts.js:19:23)
➤ YN0000: [@joplin/app-desktop]:     at module.exports (C:\users\name\jopclone\joplin\packages\app-desktop\tools\compileScripts.js:47:2)
➤ YN0000: [@joplin/app-desktop]:     at taskWrapper (C:\users\name\jopclone\joplin\packages\app-desktop\node_modules\undertaker\lib\set-task.js:13:15)
➤ YN0000: [@joplin/app-desktop]:     at bound (node:domain:421:15)
➤ YN0000: [@joplin/app-desktop]:     at runBound (node:domain:432:12)
➤ YN0000: [@joplin/app-desktop]:     at asyncRunner (C:\users\name\jopclone\joplin\packages\app-desktop\node_modules\async-done\index.js:55:18) {
➤ YN0000: [@joplin/app-desktop]:   errno: -4058,
➤ YN0000: [@joplin/app-desktop]:   code: 'ENOENT',
➤ YN0000: [@joplin/app-desktop]:   syscall: 'spawnSync yarn',
➤ YN0000: [@joplin/app-desktop]:   path: 'yarn',
➤ YN0000: [@joplin/app-desktop]:   spawnargs: [
➤ YN0000: [@joplin/app-desktop]:     'run',
➤ YN0000: [@joplin/app-desktop]:     'babel',
➤ YN0000: [@joplin/app-desktop]:     '--presets',
➤ YN0000: [@joplin/app-desktop]:     'react',
➤ YN0000: [@joplin/app-desktop]:     '--out-file',
➤ YN0000: [@joplin/app-desktop]:     'C:\\users\\name\\jopclone\\joplin\\packages\\app-desktop\\tools/../gui/ExtensionBadge.min.js',
➤ YN0000: [@joplin/app-desktop]:     'C:\\users\\name\\jopclone\\joplin\\packages\\app-desktop\\tools/../gui/ExtensionBadge.jsx'
➤ YN0000: [@joplin/app-desktop]:   ]
➤ YN0000: [@joplin/app-desktop]: }
➤ YN0000: [@joplin/server]: Process exited (exit code 0), completed in 3s 520ms
➤ YN0000: [@joplin/app-desktop]: Process exited (exit code 1), completed in 3s 558ms
➤ YN0000: [joplin]: Process exited (exit code 0), completed in 3s 567ms
➤ YN0000: [@joplin/turndown-plugin-gfm]: 
➤ YN0000: [@joplin/turndown-plugin-gfm]: src/gfm.js → lib/turndown-plugin-gfm.cjs.js...
➤ YN0000: [@joplin/turndown-plugin-gfm]: created lib/turndown-plugin-gfm.cjs.js in 49ms
➤ YN0000: [@joplin/turndown-plugin-gfm]: Process exited (exit code 0), completed in 0s 938ms
➤ YN0000: [@joplin/fork-htmlparser2]: Process exited (exit code 0), completed in 8s 394ms
➤ YN0000: [@joplin/app-mobile]: Creating: C:\users\name\jopclone\joplin/packages/app-mobile/lib/rnInjectedJs/webviewLib.js
➤ YN0000: [@joplin/app-mobile]: Creating: C:\users\name\jopclone\joplin/packages/app-mobile/lib/rnInjectedJs/CodeMirror.bundle.js
➤ YN0000: [@joplin/app-mobile]: [e[90m14:17:30e[39m] Finished 'buildInjectedJs' after 14 s
➤ YN0000: [@joplin/app-mobile]: [e[90m14:17:30e[39m] Starting 'encodeAssets'...
➤ YN0000: [@joplin/app-mobile]: [e[90m14:17:30e[39m] Finished 'encodeAssets' after 152 ms
➤ YN0000: [@joplin/app-mobile]: [e[90m14:17:30e[39m] Starting 'podInstall'...
➤ YN0000: [@joplin/app-mobile]: [e[90m14:17:30e[39m] Finished 'podInstall' after 293 μs
➤ YN0000: [@joplin/app-mobile]: [e[90m14:17:30e[39m] Finished 'build' after 15 s
➤ YN0000: [@joplin/app-mobile]: Process exited (exit code 0), completed in 17s 837ms
➤ YN0000: Done in 17s 861ms

I've attempted this twice now, this is actually the second attempt after I re-installed node.js and removed the original clone I took of the repo. The original log files from the first attempt were basically identical with failures on those same lines.
C:\\users\\name\\jopclone\\joplin\\packages\\app-desktop\\tools/../gui/ExtensionBadge.min.js
C:\\users\\name\\jopclone\\joplin\\packages\\app-desktop\\tools/../gui/ExtensionBadge.jsx

Any ideas?

I don't know if Windows build tools are still necessary because if you install the latest Node version you can install them too, and that's apparently the preferred way now.

And we indeed need to fix the readme files because yarn doesn't have -g

I'm happy to submit doc PRs for the process but I wanted to make sure it can all be built first based on the instructions and I'm currently stuck at the same point twice having wiped the slate already.

I'll give it a go again but this time I won't run the windows build tools command at all in case that screwed something up to see if anything changes at all.

Do you have VSCode open? Because I think it locks the working directory in a way that makes yarn and npm fail.

Also if you have a command like this to fail:

 path: 'yarn',
  spawnargs: [
    'run',
    'babel',
    '--presets',
    'react',
    '--out-file',
    'C:\\users\\name\\jopclone\\joplin\\packages\\app-desktop\\tools/../gui/ExtensionBadge.min.js',
    'C:\\users\\name\\jopclone\\joplin\\packages\\app-desktop\\tools/../gui/ExtensionBadge.jsx'

You could try to run it manually - yarn run babel --preset .... and see if it fails in this case too.

No, not even installed, the only thing on my computer even vaguely pointing to that dir is powershell which is running the actual stuff.

Now this could just be me being an idiot, I hadn't even got to grips with npm much yet, let alone yarn but trying to run that as the following (which is probably wrong somehow...) resulted in:

PS C:\users\name\jopclone\joplin> yarn run babel --presets react --out-file 'C:\\users\\name\\jopclone\\joplin\\packages\\app-desktop\\tools/../gui/ExtensionBadge.min.js'
Usage Error: Couldn't find a script named "babel".

Is this meant to be exected in the root folder or in .../packages/app-desktop?

You would run this command from packages/app-desktop actually, which is where babel is installed.

And do you run Powershell or Cmd as admin?

3 mins in and it is just sitting there blinking at me:

PS C:\users\name\jopclone\joplin\packages\app-desktop> yarn run babel --presets react --out-file 'C:\\users\\name\\jopclone\\joplin\\packages\\app-desktop\\tools/../gui/ExtensionBadge.min.js'

Yes, PS running as admin

ok that's very strange it would just get stuck. What if you call babel directly? node node_modules/babel-cli/bin/babel.js --preset ....?

Edit: Also try with plain Cmd too because normally that's what we support.

Just gives the blinky cursor like before.

cmd yarn install as admin results in exactly the same situation.

I'm going to start fresh again in case I did break something during the windows tools step that may not be necessary any more

It sounds like something is locked in that folder so maybe the good old turn your computer off an on again would help.

Started from a clean slate again, no node.js, no half built Joplin.

Installed node.js, enabled corepack, didn't run those windows tools additions - reboots at pretty much every step, yarn install in an elevated cmd prompt was the first thing I did post reboot.

Fails in exactly the same place as before.

I have a dying laptop somewhere, I can see if it is just this PC failing.

I followed the same path as @Daeraxa and got stuck.

Error: spawnSync yarn ENOENT

The cause is cmd.exe cannot execute yarn. Changing the shell or using yarn.cmd is needed.
By rewriting app-desktop/tools/compileScripts.js as follows, I succeeded in the build.

- const result = spawnSync('yarn', ['run', 'babel', '--presets', 'react', '--out-file', jsPath, jsxPath]);
+ const result = spawnSync('yarn', ['run', 'babel', '--presets', 'react', '--out-file', jsPath, jsxPath], { shell: true });
1 Like

Thanks for looking, I'll change that mysef in a bit and see if it also resolves for me.

That worked perfectly (tested in cmd rather than ps) - I did have to re-clone as something had broken somewhere that wouldn't work just by running yarn install again with those modifications.

So in conclusion (at least for me):

  • Node 16+ build works on Windows
  • Windows: Install Windows Build Tools - yarn install -g windows-build-tools --vs2015 is no longer required if using Node 16+ (assume on all 16+ versions but I have 16.13.1)
  • Corepack needs to be enabled if using v16.9+ - need to run corepack enable - if it was installed as part of the node.js installer.
    • Obviously if yarn or pnpm then it may not be necessary
    • Corepack is automatically enabled in v17+
  • Change the line @ken1kob identified in the compileScripts.js

@laurent :I'm happy to submit a docs PR for those first items if it is agreed that they make sense. I'll leave the compileScripts change to @ken1kob unless either of you feel differently.

I'll leave the compileScripts change to @ken1kob unless either of you feel differently.

Adding {shell: true} means 'yarn' is interpreted by a shell, so I think it's cross platform. But I checked it only on Windows.

I'm planning to set up a build on macOS tomorrow and I'll try the modification out on my normal Linux system as well so I should be able to report back on that.

Sure feel free to create a pull request for it. For Yarn, we'll link to the relevant doc page so that we don't have to maintain this (like we do for Node and React Native installation instructions).

Regarding, the spawnSync call, it's strange that it works on CI but not on your computers. I'm fine with the change I guess but I'm wondering what Yarn it's using in this call? We bundle Yarn on the repo (under .yarn/) so that everybody has the same version of it, but in this case I'm not sure if it's using that one or the globally installed one.

Edit: I've just checked and it's indeed using the repo's yarn, so no problem then.

I assume it depends on which shell is used. If bash is used, it would be OK. If cmd.exe is used, it causes an error, since cmd.exe requires not yarn but yarn.cmd.

Ref. spawnSync() | Node.js v17.3.0 Documentation

I was having a read of that yesterday, was going to (but have run out of time now until after christmas) to compare the build times on linux as I was reading it might affect the performance?