Trying to build Etcher on Raspberry Pi 4

I’m trying to build Etcher on a Raspberry Pi 4, as part of a larger effort to see if I can use the Pi4 as a daily driver desktop replacement.

I found this post with some starting tips. That pointed me to the Contributing.md document in the github project. No problems with the Common and Linux prerequisites, or cloning the project.

When I try “Installing npm dependencies” via “make electron-develop” I get the following:

./scripts/resin/electron/install.sh \
-b /home/pi/Documents/etcher \
-r armv7hf \
-s linux \
-m 6.7.0

/bin/bash: line 1: ./scripts/resin/electron/install.sh: No such file or directory
make: *** [Makefile:97: electron-develop] Error 127

It’s true, that script does not exist, actually the whole electron subdirectory does not exist.

Any suggestions of where I go from here?

NOTE: “make info” gives this output:

Platform            : linux

Host arch : armv7hf
Target arch : armv7hf

Hi @tinker2much I haven’t ever built etcher, but if there is a directory missing, perhaps when you git cloned the project you missed the recursive piece to pull all the git submodules? can you confirm that git clone --recursive https://github.com/balena-io/etcher worked as expected?

Thank you, @shaunmulligan!

I had NOT specified --recursive before. I just did so, and I got the directories and scripts I was missing before.

I’m now able to proceed with “make electron-develop”.

Possible issue : does it matter that my version of npm is older than the CONTRIBUTING document says, which is “npm (version 6.7)”?

According to apt "npm is already the newest version (5.8.0+ds6-4).

The “make electron-develop” did fail eventually as follows:

electron-chromedriver@3.0.0 install /home/pi/Documents/etcher/node_modules/electron-chromedriver
node ./download-chromedriver.js
/home/pi/Documents/etcher/node_modules/electron-chromedriver/download-chromedriver.js:19
if (err != null) throw err
^
Error: Failed to find Electron v3.0.0 for linux-arm at https://github.com/electron/electron/releases/download/v3.0.0/chromedriver-v3.0.0-linux-arm.zip

I snooped around the Electron releases, and found this page v3.0.0, but they only had files for
arm64 and armv7l, not plain arm.

So do I actually need to be requesting armv7l?

Back to my question about whether my npm is too old. The “make electron-develop” process said:
node: v10.15.2
npm: 5.8.0
NPM configuration
npm WARN npm npm does not support Node.js v10.15.2
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can’t make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/

This implies to me that my version of npm is so old it doesn’t even know about node version 10, and thinks I need to move up from something really ancient to 4,6,7,8, or 9?

(I have never worked with either node or electron before, so please forgive what are probably total newbie questions.)

Hi @tinker2much ,

Debian and Ubuntu (Debian especially) run with older and known stable versions of packages. However, this means that a lot of software doesn’t get updated for quite a while in packaged form. Given this, I’m not surprised that apt doesn’t have a later version.

That said, you can actually update NPM manually using itself. To get to the latest version, which will support Node 10, 11, 12, you can run:

npm -g install npm@latest

Note that you may need to use sudo prefixing the npm command depending on how the package was originally installed.

This will bring NPM up to the latest (which I believe is 6.12.0) and allow you to continue!

Best regards,

Heds

@hedss - thanks for the tip. I DID have to use sudo, and got npm 6.12.0.

That solved the “make electron-develop” process’s complaints about versions.

It does still fail, as mentioned above, on trying to get v3.0.0 software for a straight arm architecture:

Error: Failed to find Electron v3.0.0 for linux-arm at https://github.com/electron/electron/releases/download/v3.0.0/chromedriver-v3.0.0-linux-arm.zip

Here is the complete text around that error:

> electron-chromedriver@3.0.0 install /home/pi/Documents/etcher/node_modules/electron-chromedriver
> node ./download-chromedriver.js

/home/pi/Documents/etcher/node_modules/electron-chromedriver/download-chromedriver.js:19
  if (err != null) throw err
                   ^

Error: Failed to find Electron v3.0.0 for linux-arm at https://github.com/electron/electron/releases/download/v3.0.0/chromedriver-v3.0.0-linux-arm.zip
    at Request.<anonymous> (/home/pi/Documents/etcher/node_modules/nugget/index.js:169:61)
    at Request.emit (events.js:189:13)
    at Request.onRequestResponse (/home/pi/Documents/etcher/node_modules/request/request.js:1066:10)
    at ClientRequest.emit (events.js:189:13)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:556:21)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17)
    at TLSSocket.socketOnData (_http_client.js:442:20)
    at TLSSocket.emit (events.js:189:13)
    at addChunk (_stream_readable.js:284:12)
    at readableAddChunk (_stream_readable.js:265:11)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: winusb-driver-generator@1.2.4 (node_modules/winusb-driver-generator):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for winusb-driver-generator@1.2.4: wanted {"os":"win32","arch":"any"} (current: {"os":"linux","arch":"arm"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron-chromedriver@3.0.0 install: `node ./download-chromedriver.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the electron-chromedriver@3.0.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2019-10-28T18_26_07_824Z-debug.log
make: *** [Makefile:97: electron-develop] Error 1

So what is going on? If the makefile should be requesting arm, why doesn’t it exist on that site? Or should we be requesting armv7hf (which is the architecture “make info” states, but which doesn’t exist there either ;-).

Should I be asking such code-building questions here, or should I create an issue on the github page?

I just happened to get an account here first, but I would rather go to the most appropriate place.

@tinker2much You can also open an issue on github here, the difference is that we try to generally keep the issues on github to be as product-specific as possible (e.g. we don’t currently support etcher on arm architecture), while on the forums the discussion can be more open and involve also other people both internal and external to the team to answer and try to figure it out, which doesn’t necessarily happen on the repository although we have some contributors that still like to check the github issues every now and then.

Regarding your issue, did updating npm solve it?

It got me past the npm version-related issues, but “make electron-develop” still fails as detailed in a previous post, specifically unable to get v3.0.0 of some software for arm.

I gave more details in a post I made earlier today, but it’s being held for review for some reason.

I see, it’s the npm package electron-chromedriver. I’d suggest trying to manually build that and if the build succeeds, copy over your own electron-chromedriver so that it shouldn’t be installed from the releases if this is the situation.
You shouldn’t need to as we rebuild modules, but since it tries to download the release without falling back to rebuilding the package, let’s first try this and see how it goes.

So, here’s what I guessed I had to do, and I just went ahead and tried it. (Remember, I have -zero- experience with node or electron or javascript, so you’re dealing with a fearless 2-year old here - "cross the busy road - sure!)

I had no idea where such code might go, so I did a find through the project:
find . -name electron-chromedriver* -ls
(which found nothing)

I thought to grep for this module, and did find it:

grep -ir electron-chromedriver
node_modules/electron-download/package.json: “/electron-chromedriver”
node_modules/extract-zip/package.json: “/electron-chromedriver”
npm-shrinkwrap.json: “electron-chromedriver”: {
npm-shrinkwrap.json: “resolved”: “https://registry.npmjs.org/electron-chromedriver/-/electron-chromedriver-3.0.0.tgz”,
npm-shrinkwrap.json: “electron-chromedriver”: “~3.0.0”,

That pointed me to node-modules as the place where node modules go (obvious in retrospect), and gave me a clue of where to download it from. So I downloaded that URL, created a new directory under node-modules called “electron-chromedriver” and unpacked it there.

I read the README.md file and found a line that looked like it should install the module, so I tried it:

npm install --save-dev electron-chromedriver

> electron-chromedriver@7.0.0 install /home/pi/Documents/etcher/node_modules/electron-chromedriver
> node ./download-chromedriver.js


> undefined postshrinkwrap /home/pi/Documents/etcher
> node ./scripts/clean-shrinkwrap.js

[OK] Wrote shrinkwrap file to ../npm-shrinkwrap.json
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: winusb-driver-generator@1.2.4 (node_modules/winusb-driver-generator):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for winusb-driver-generator@1.2.4: wanted {"os":"win32","arch":"any"} (current: {"os":"linux","arch":"arm"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})

+ electron-chromedriver@7.0.0
added 1 package from 1 contributor, updated 1 package and audited 13389 packages in 64.918s
found 321 vulnerabilities (1 low, 10 moderate, 310 high)
  run `npm audit fix` to fix them, or `npm audit` for details

So, there’s a lot of slightly worrying output there. Should I be concerned?

The README suggested doing “chromedriver -h”, which I tried but it couldn’t find such an executable. I rooted around and found it within the apparently-newly-created bin directory within the module, which makes me think the install succeeded, and in fact it does execute and I got the expected help.

I will proceed to try the “make electron-develop” again.

Hello,

The installation tries to download https://github.com/electron/electron/releases/download/v3.0.0/chromedriver-v3.0.0-linux-arm.zip instead of https://github.com/electron/electron/releases/download/v3.0.0/chromedriver-v3.0.0-linux-armv7l.zip (note the v7l after arm).
I believe this is a bug in the scripts repository.

You can probably avoid it by not using make electron-develop.
Could you please try the following on a fresh clone of etcher (please check that you’re using npm >= 6.7.0 first):

  • npm i
  • ./node_modules/.bin/electron-builder .

It should build an etcher release in the dist folder.

well, here’s what I get from “make electron-develop”. Beyond noting this line:

npm ERR! electron-chromedriver@3.0.0 install: `node ./download-chromedriver.js`

and that download-chromedriver.js is part of the package I downloaded before, I am clearly out of my depth and need help.

> electron-chromedriver@3.0.0 install /home/pi/Documents/etcher/node_modules/spectron/node_modules/electron-chromedriver
> node ./download-chromedriver.js

/home/pi/Documents/etcher/node_modules/spectron/node_modules/electron-chromedriver/download-chromedriver.js:19
  if (err != null) throw err
                   ^

Error: Failed to find Electron v3.0.0 for linux-arm at https://github.com/electron/electron/releases/download/v3.0.0/chromedriver-v3.0.0-linux-arm.zip
    at Request.<anonymous> (/home/pi/Documents/etcher/node_modules/nugget/index.js:169:61)
    at Request.emit (events.js:189:13)
    at Request.onRequestResponse (/home/pi/Documents/etcher/node_modules/request/request.js:1066:10)
    at ClientRequest.emit (events.js:189:13)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:556:21)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17)
    at TLSSocket.socketOnData (_http_client.js:442:20)
    at TLSSocket.emit (events.js:189:13)
    at addChunk (_stream_readable.js:284:12)
    at readableAddChunk (_stream_readable.js:265:11)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: winusb-driver-generator@1.2.4 (node_modules/winusb-driver-generator):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for winusb-driver-generator@1.2.4: wanted {"os":"win32","arch":"any"} (current: {"os":"linux","arch":"arm"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron-chromedriver@3.0.0 install: `node ./download-chromedriver.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the electron-chromedriver@3.0.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2019-10-29T15_29_48_295Z-debug.log
make: *** [Makefile:97: electron-develop] Error 1

I just saw the post from @zvin, we were posting at about the same instant.

I will do what you suggest, but I have to go do some other business first for a couple hours at least, so it will be a while until we see how that goes.

@zvin, I cloned etcher again. I do have v??? of npm.

I ran “npm io” from within the project and it took 798 seconds and it did a lot, including downloading and building a LOT of software - most of the output flashing by almost too fast to read. Here’s the last page or so of output:

  rm -rf "Release/binding.node" && cp -af "Release/obj.target/binding.node" "Release/binding.node"
make: Leaving directory '/home/pi/Documents/etcher/node_modules/node-sass/build'
gyp info ok 
Installed to /home/pi/Documents/etcher/node_modules/node-sass/vendor/linux-arm-64/binding.node

> balena-etcher@1.5.60 install /home/pi/Documents/etcher
> node-gyp rebuild

make: Entering directory '/home/pi/Documents/etcher/build'
  SOLINK_MODULE(target) Release/obj.target/elevator.node
  COPY Release/elevator.node
make: Leaving directory '/home/pi/Documents/etcher/build'

> undefined postshrinkwrap /home/pi/Documents/etcher
> node ./scripts/clean-shrinkwrap.js

[OK] Wrote shrinkwrap file to ../npm-shrinkwrap.json
added 1643 packages from 1694 contributors and audited 13181 packages in 798.975s
found 321 vulnerabilities (1 low, 10 moderate, 310 high)
  run `npm audit fix` to fix them, or `npm audit` for details

Now about to try “./node_modules/.bin/electron-builder .”

I forgot to fill in the version of npm in that last message - it’s 6.12.0

I did “./node_modules/.bin/electron-builder .” and it failed right away.

pi@pi4:~/Documents/etcher $ ./node_modules/.bin/electron-builder .
Configuring yargs through package.json is deprecated and will be removed in the next major release, please use the JS API instead.
Configuring yargs through package.json is deprecated and will be removed in the next major release, please use the JS API instead.
  • electron-builder version=20.40.2
  • loaded configuration file=/home/pi/Documents/etcher/electron-builder.yml
  • writing effective config file=dist/builder-effective-config.yaml
Error: Unsupported arch arm
    at archFromString (/home/pi/Documents/etcher/node_modules/builder-util/src/arch.ts:43:13)
    at computeArchToTargetNamesMap (/home/pi/Documents/etcher/node_modules/app-builder-lib/src/targets/targetFactory.ts:36:18)
    at /home/pi/Documents/etcher/node_modules/app-builder-lib/src/packager.ts:415:41
    at Generator.next (<anonymous>)
From previous event:
    at Packager.doBuild (/home/pi/Documents/etcher/node_modules/app-builder-lib/src/packager.ts:396:24)
    at /home/pi/Documents/etcher/node_modules/app-builder-lib/src/packager.ts:366:57
    at Generator.next (<anonymous>)
    at /home/pi/Documents/etcher/node_modules/graceful-fs/graceful-fs.js:111:16
    at /home/pi/Documents/etcher/node_modules/graceful-fs/graceful-fs.js:45:10
    at FSReqWrap.oncomplete (fs.js:141:20)
From previous event:
    at Packager._build (/home/pi/Documents/etcher/node_modules/app-builder-lib/src/packager.ts:335:133)
    at /home/pi/Documents/etcher/node_modules/app-builder-lib/src/packager.ts:331:23
    at Generator.next (<anonymous>)
    at runCallback (timers.js:705:18)
    at tryOnImmediate (timers.js:676:5)
    at processImmediate (timers.js:658:5)
From previous event:
    at Packager.build (/home/pi/Documents/etcher/node_modules/app-builder-lib/src/packager.ts:288:14)
    at build (/home/pi/Documents/etcher/node_modules/app-builder-lib/src/index.ts:59:28)
    at build (/home/pi/Documents/etcher/node_modules/electron-builder/src/builder.ts:228:10)
    at then (/home/pi/Documents/etcher/node_modules/electron-builder/src/cli/cli.ts:46:19)