Sync/Tunneling challenge using resin-cli + Pi 3 + node.js from Mac High Sierra

Hello,
I’m having starting success, logging into a Pi via resin.io website terminal (way cool!) and running the sample node.js express server after pushing via Git on my Mac (also way cool!).

Getting resin-cli setup on my Mac has been a challenge.

node v8.9.3
Mac High Sierra v0.13.2
rsync v2.6.9

When I run:
sudo npm install --global --production resin-cli

It fails with this output:

sudo npm install --global --production resin-cli
npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated graceful-fs@1.2.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated graceful-fs@3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
/usr/local/bin/resin -> /usr/local/lib/node_modules/resin-cli/bin/resin

> ext2fs@0.1.1 install /usr/local/lib/node_modules/resin-cli/node_modules/ext2fs
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(undefined): https://github.com/resin-io/node-ext2fs/releases/download/v0.1.1/bindings-v0.1.1-node-v57-darwin-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for ext2fs@0.1.1 and node@8.9.3 (node-v57 ABI, unknown) (falling back to source compile with node-gyp) 
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/resin-cli/node_modules/ext2fs/build'
gyp ERR! System Darwin 17.3.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/local/lib/node_modules/resin-cli/node_modules/ext2fs/pregyp/bindings.node" "--module_name=bindings" "--module_path=/usr/local/lib/node_modules/resin-cli/node_modules/ext2fs/pregyp"
gyp ERR! cwd /usr/local/lib/node_modules/resin-cli/node_modules/ext2fs
gyp ERR! node -v v8.9.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/resin-cli/node_modules/ext2fs/pregyp/bindings.node --module_name=bindings --module_path=/usr/local/lib/node_modules/resin-cli/node_modules/ext2fs/pregyp' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/resin-cli/node_modules/ext2fs/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:925:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Darwin 17.3.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/resin-cli/node_modules/ext2fs/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/resin-cli/node_modules/ext2fs
node-pre-gyp ERR! node -v v8.9.3
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/resin-cli/node_modules/ext2fs/pregyp/bindings.node --module_name=bindings --module_path=/usr/local/lib/node_modules/resin-cli/node_modules/ext2fs/pregyp' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: removedrive@1.1.2 (node_modules/resin-cli/node_modules/removedrive):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for removedrive@1.1.2: wanted {"os":"win32","arch":"any"} (current: {"os":"darwin","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ext2fs@0.1.1 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the ext2fs@0.1.1 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!     /Users/me/.npm/_logs/2018-01-04T00_08_21_865Z-debug.log

If I download the latest darwin zip and add the path to my .profile, I can run the resin cli and even pick my device (awesome!). The challenge occurs when I attempt to sync or ssh in to a device:

resin ssh

I choose my device, then this output occurs:

Connecting to: abcde12345.....
ResinRequestError: Request error: tunneling socket could not be established, cause=socket hang up

If you need help, don't hesitate in contacting us at:

  GitHub: https://github.com/resin-io/resin-cli/issues/new
  Forums: https://forums.balena.io

I’m guessing I could still develop via git pushes, correct (reading up on all that now)? Let me know if you’ve run into this before and if there’s a good solution or something I can try.

Thanks for taking a look. :slight_smile:

Hi Chris,
Is the device or your local machine behind a proxy?
If so, do you see the same error if you connect using a different network? (cell phone tethering for example)
Thanks,
Lucian

Hi Lucian,
I’m not behind a proxy. I am able to connect to an Amazon EC2 instance via SSH. I can also SSH via cell tethering.

Wild guess at the moment: Macs can be a pain when it comes to tunneling. I was evaluating platform.sh hosting sometime back, another Git-based solution (nice service), running into tunneling issues. There was a dependencies that needed to be installed via homebrew or other means that messed up other dependencies. We ended up not tunneling at all. Maybe this is a different kind of tunneling? I’m open to thoughts.

Kind regards,

Chris

Hi Chris,

About the first issue, if you still want to install resin-cli via npm, you could try running sudo npm install --global --production resin-cli --unsafe-perm=true --allow-root.

And about the second issue, could you please try running resin ssh -v so we can get a look at the ssh command output ?

Hmm. It looks like this may have been resolved. I’m able to login via resin ssh now. Maybe: This is a result of using a different base image?

Before:

FROM resin/%%RESIN_MACHINE_NAME%%-node:6-slim (from the getting started tutorial)

after:

FROM resin/%%RESIN_MACHINE_NAME%%-node:latest

I can try the original again if desired.

Thanks a ton for your time!

Hi, I’m glad your issue is solved. I don’t think it was due to the base image.

Have a nice day.