build instructions

Change-type: patch
This commit is contained in:
Zane Hitchcox 2021-06-26 13:16:44 -04:00
parent ccb08a48f1
commit 2be29e22c2

81
BUILD.md Normal file
View File

@ -0,0 +1,81 @@
# Building etcher on Windows, Linux, and Mac
> How do you build etcher? On Windows, Linux, Mac
Its the same on all systems:
First clone the repository recursively:
`git clone --recursive https://github.com:balena-io/etcher`
```
rm -rf node_modules
make electron-develop
npm start
```
To build packages for distribution, run `make electron-build` after the steps above.
### Windows
> What version of mingw and visual studio are needed to build? Any other dependencies for windows? Instructions for how to install?
Visual studio 2019 with:
MSVC v142
Windows 10 SDK
Mingw64, install it from https://www.msys2.org/
> It appears youre supposed to use `npm i` and then `npm watch` and then `npm start` in order to build/run the electron app, but Im getting the error:
NODE_MODULE_VERSION 88. This version of Node.js requires
NODE_MODULE_VERSION 80. Please try re-compiling or re-installing
From the module `xxhash`
This error means that a module wasnt built for the correct runtime (node or electron) and version. In general it means that either you ran `npm i` instead of `make electron-develop` or you just updated the electron version.
Remove the node_modules folder and run `make electron-develop`, that should fix it.
If you want to use only npm, set up some env vars to target the correct runtime as in https://github.com/balena-io/EtcherProApplication/blob/v1.0.0/Dockerfile#L11-L13
Each time you change a js file, you need to run `npm webpack` again. This is quite slow. To make it faster leave `npm run watch` running. It actually just runs `webpack --watch`
https://github.com/electron/electron/blob/master/docs/tutorial/using-native-node-modules.md
### Mac OS X
Install XCode via the App Store
> I get the error: `gyp: No Xcode or CLT version detected!`
Fix with:
```
sudo xcodebuild -license accept
```
> I get the error: `xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance`
Fix with:
```
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
```
> I get the error: `[webpack-cli] Error: Could not find lzma_native binding`
Try removing node_modules and running `make electron-develop` again.
### Linux
Should work OOTB, please create issue if not.
* Note: Might have to downgrade to Node 14
### FreeBSD
Should work OOTB, please create issue if not.
* Note: Might have to downgrade to Node 14