Deploy failed when running balena deploy

#1
balena deploy myApp--logs --source . --emulated

[Error]   Deploy failed
The command '/tmp/qemu-execve -execve /bin/sh -c JOBS=MAX npm config set unsafe-perm true && npm install --unsafe-perm --production && npm cache clean --force && npm i npm@latest -g &&   rm -rf /tmp/* && node_modules/.bin/electron-rebuild' returned a non-zero code: 127
#5

Hi everyone

I have the same problem. I followed the Getting Started Guide and double checked everything with the recently released Setup-Stream recording.
I am trying to deploy the Example Application but it is crashing in the build process. I am on Arch, using the the Npm Balena-CLI.

Here is the output:

[dario@ArchDW sense-snake]$ DEBUG=1 balena deploy openBalenaTest --logs --source . --emulated
[Debug]   Parsing input...
[Debug]   Loading project...
[Debug]   Resolving project...
[Debug]   Failed to resolve project: 
[Debug]   AggregateError of:
[Debug]       Error: ENOENT: no such file or directory, open '/home/dario/balena/sense-snake/docker-compose.yml'
[Debug]       Error: ENOENT: no such file or directory, open '/home/dario/balena/sense-snake/docker-compose.yaml'
[Info]    Creating default composition with source: /home/dario/balena/sense-snake
[Debug]   Creating project...
[Info]    Building for armv7hf/raspberrypi3
[Build]   Building services...
[Build]   main Preparing...
[Info]    Emulation is enabled
[Debug]   Found build tasks:
[Debug]       main: build [.]
[Debug]   Resolving services with [raspberrypi3|armv7hf]
[Debug]   Found project types:
[Debug]       main: Dockerfile.template
[Debug]   Prepared tasks; building...
[Build]   main Step 1/13 : FROM resin/raspberrypi3-node:8.5.0 AS base
[Build]   main  ---> cef40d008ff1
[Build]   main Step 2/13 : COPY [".balena/qemu-execve","/tmp/qemu-execve"]
[Build]   main  ---> Using cache
[Build]   main  ---> ed0bc7ee9e48
[Build]   main Step 3/13 : WORKDIR /usr/src/app
[Build]   main  ---> Using cache
[Build]   main  ---> d46077ba63f9
[Build]   main Step 4/13 : COPY ["package.json","."]
[Build]   main  ---> Using cache
[Build]   main  ---> 0ccf89689b98
[Build]   Built 1 service in 0:03
[Error]   Deploy failed
Error: The command '/tmp/qemu-execve -execve /bin/sh -c JOBS=MAX npm install --unsafe-perm --production' returned a non-zero code: 139
    at Stream.<anonymous> (/usr/lib/node_modules/balena-cli/node_modules/resin-docker-build/build/builder.js:178:23)
    at Stream.stream.write (/usr/lib/node_modules/balena-cli/node_modules/through/index.js:26:11)
    at Stream.ondata (internal/streams/legacy.js:15:31)
    at Stream.emit (events.js:197:13)
    at Stream.EventEmitter.emit (domain.js:481:20)
    at drain (/usr/lib/node_modules/balena-cli/node_modules/through/index.js:36:16)
    at Stream.stream.queue.stream.push (/usr/lib/node_modules/balena-cli/node_modules/through/index.js:45:5)
    at Parser.parser.onToken (/usr/lib/node_modules/balena-cli/node_modules/JSONStream/index.js:132:18)
    at Parser.proto.write (/usr/lib/node_modules/balena-cli/node_modules/jsonparse/jsonparse.js:135:34)
    at Stream.<anonymous> (/usr/lib/node_modules/balena-cli/node_modules/JSONStream/index.js:23:12)
    at Stream.stream.write (/usr/lib/node_modules/balena-cli/node_modules/through/index.js:26:11)
    at IncomingMessage.ondata (_stream_readable.js:696:20)
    at IncomingMessage.emit (events.js:197:13)
    at IncomingMessage.EventEmitter.emit (domain.js:481:20)
    at addChunk (_stream_readable.js:288:12)
    at readableAddChunk (_stream_readable.js:269:11)
    at IncomingMessage.Readable.push (_stream_readable.js:224:10)
    at HTTPParser.parserOnBody (_http_common.js:126:22)
    at Socket.socketOnData (_http_client.js:447:20)
    at Socket.emit (events.js:197:13)
    at Socket.EventEmitter.emit (domain.js:481:20)
    at addChunk (_stream_readable.js:288:12)
    at readableAddChunk (_stream_readable.js:269:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at Pipe.onStreamRead [as onread] (internal/stream_base_commons.js:150:17)

Thanks a lot
Dario

#7

Could you update to the latest balena-cli version and try again? This looks like an issue in the CLI tool rather that something openBalena specific.

#8

Hi, i have the same issue:

balena deploy MiApp --source /home/dcanob/app/main/rpi/ --deviceType raspberrypi3 --arch armv7hf --logs --emulated --build --nocache 
[Info]    Compose file detected
[Info]    Building for armv7hf/raspberrypi3
[Build]   Building services...
[Build]   app Preparing...
[Info]    Emulation is enabled
[Build]   app Step 1/10 : FROM resin/raspberrypi3-node:10-stretch
[Build]   app  ---> 881b7a980651
[Build]   app Step 2/10 : COPY [".balena/qemu-execve","/tmp/qemu-execve"]
[Build]   app  ---> faee13532c97
[Build]   app Step 3/10 : ENV INITSYSTEM="on"
[Build]   app  ---> Running in 5c880e11efff
[Build]   app Removing intermediate container 5c880e11efff
[Build]   app  ---> c18cb5949b01
[Build]   app Step 4/10 : ENV UDEV="1"
[Build]   app  ---> Running in fda0a7ca2f4a
[Build]   app Removing intermediate container fda0a7ca2f4a
[Build]   app  ---> 103030dc59ac
[Build]   app Step 5/10 : ENV DBUS_SYSTEM_BUS_ADDRESS="unix:path=/host/run/dbus/system_bus_socket"
[Build]   app  ---> Running in 786425143d36
[Build]   app Removing intermediate container 786425143d36
[Build]   app  ---> 2ad0edb37f58
[Build]   app Step 6/10 : WORKDIR /usr/src/app
[Build]   app  ---> Running in 89d9668bfc05
[Build]   app Removing intermediate container 89d9668bfc05
[Build]   app  ---> 49ed8bd73304
[Build]   app Step 7/10 : COPY [".","./"]
[Build]   app  ---> 3b8aaaa88a14
[Build]   app Step 8/10 : RUN ["/tmp/qemu-execve","-execve","/bin/sh","-c","JOBS=MAX npm install --unsafe-perm --production"]
[Build]   app  ---> Running in c0bc262eedc3
[Build]   app > mi-ecobox@1.0.6 postinstall /usr/src/app
[Build]   app > electron-rebuild
[Build]   app internal/modules/cjs/loader.js:583
[Build]   app     throw err;
[Build]   app     ^
[Build]   app Error: Cannot find module './rebuild'
[Build]   app     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
[Build]   app     at Function.Module._load (internal/modules/cjs/loader.js:507:25)
[Build]   app     at Module.require (internal/modules/cjs/loader.js:637:17)
[Build]   app     at require (internal/modules/cjs/helpers.js:20:18)
[Build]   app     at Object.<anonymous> (/usr/src/app/node_modules/.bin/electron-rebuild:17:19)
[Build]   app     at Module._compile (internal/modules/cjs/loader.js:689:30)
[Build]   app     at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
[Build]   app     at Module.load (internal/modules/cjs/loader.js:599:32)
[Build]   app     at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
[Build]   app     at Function.Module._load (internal/modules/cjs/loader.js:530:3)
[Build]   app npm ERR! code ELIFECYCLE
[Build]   app npm ERR! errno 1
[Build]   app npm ERR! mi-ecobox@1.0.6 postinstall: `electron-rebuild`
[Build]   app npm ERR! Exit status 1
[Build]   app npm ERR! 
[Build]   app npm ERR! Failed at the mi-ecobox@1.0.6 postinstall script.
[Build]   app npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[Build]   app npm ERR! A complete log of this run can be found in:
[Build]   app npm ERR!     /root/.npm/_logs/2019-04-09T04_04_15_048Z-debug.log
[Build]   Built 1 service in 1:11
[Error]   Deploy failed
The command '/tmp/qemu-execve -execve /bin/sh -c JOBS=MAX npm install --unsafe-perm --production' returned a non-zero code: 1

Additional information may be available in debug mode. Prefix the command
line with DEBUG=1, i.e.:  DEBUG=1 balena ...
If you need help, don't hesitate in contacting our support forums at
https://forums.balena.io

For bug reports or feature requests, have a look at the GitHub issues or
create a new one at: https://github.com/balena-io/balena-cli/issues/

but if run:

npm run rebuild

> mi-ecobox@1.0.6 rebuild /home/dcanob/ecobox/main/rpi/app
> electron-rebuild

✔ Rebuild Complete

and on CloudBalena this works too, my balena cli version:

balena version
10.0.0