anoff/remote-code

I got a "TypeError"

Opened this issue ยท 12 comments

I cloud not get this tool to work..
Due to this error:

.-(~/Documents/test)
`--> remote-code root@some-host.com
๐Ÿช      starting remote-code
โœˆ๏ธ       syncing files
๐Ÿ“ฆ      dependency installation started
๐Ÿ’ฃ      TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be one of type string, Buffer, or URL. Received type undefined
๐Ÿช      shutting down remote-code

My package .json:

{
  "name": "test",
  "version": "1.0.0",
  "scripts": {
    "start": "node index.js"
  },
  "main": "index.js",
  "license": "MIT",
  "dependencies": {}
}

The contents of index.js:

let count = 0
const run = () => {
        setTimeout(() => {
                count ++
                console.log(count)
                run()
        }, 200)
}
run()

Env information

The host (my laptop)

  • OS: Arch linux
  • Shell: zsh
  • uname -r: 4.20.0-arch1-1-ARCH
  • Has installed: nodejs, yarn, npm, rsync
  • lsb_release -a
LSB Version:    1.4
Distributor ID: Arch
Description:    Arch Linux
Release:        rolling
Codename:       n/a

The client (my server)

  • OS: Ubuntu 16.04
  • Shell: bash
  • uname -r: 4.4.0-140-generic
  • Has installed: Has installed: nodejs, yarn, npm, rsync
  • lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.5 LTS
Release:        16.04
Codename:       xenial
anoff commented

Sorry again for not responding earlier; is this still a problem or did you get it to work? I will try to find out which component throws that error and tomorrow try your code

anoff commented

Since the error seems to be during the install routine which is just yarn by default could you maybe try:

  1. running yarn manually in the remote directory
  2. use remote-code --install "npm install" instead

That didn't work.
remote-code --install "npm install" gave the same error
yarn also didn't work

I now also have nodemon installed on my client and host.

When i ssh into my server there is folder named: remote-sync in /root with the host's files.

When i run yarn start or npm start on my server they both execute the scripts.

In my package.json i have a main defined.

Files in host's dir:

-rw-r--r-- 1 mark users index.js
drwxr-xr-x 3 mark users node_modules
-rw-r--r-- 1 mark users package-lock.json
-rw-r--r-- 1 mark users package.json
-rw-r--r-- 1 mark users yarn.lock

Using a random dependencies just to have something in the dependencies also didn't work.

anoff commented

Does running the install command (either yarn or npm install) on the machine itself work?

Jup they both work on the host and on the client

anoff commented

hey @mjarkk sorry for taking so long. I can confirm the same behavior with my setup. However instead of trying to fix the old version I am currently working on getting the latest master commit working. There were several changes in the dependencies that I would like to get published.

That's oke i found this project interesting and wanted to try it out.

anoff commented

Could you please try it with the npm i -g remote-code@next version?

For me the following command works remote-code -i ~/.ssh/id_rsa pi@robby5 -p 2221 -S ls -t "~/debug" using your example files

Just tried it and there seem to be a view errors.
Here are the problems.

  • Need to add -i otherwise it will show: SSH identity file does not exist: undefined
  • It hangs at ๐Ÿ“ฆ dependency installation started
  • When i press ctrl+c it says shutting down remote-code but it doesn't stop (If i press a second time ctrl+c it would be nice to have a force close)

Preview:
Note: That error is because i killed the app via a task manager.
image

anoff commented

Ahh, are you not using a private key to authenticate your SSH connection? How do you log into the remote machine usually?

That might explain also you previous error

just do ssh root@machine.com and i'm in, I have multiple private keys stored in ~/.ssh/
In there i also have a config file with a list of all my keys

IdentityFile ~/.ssh/someEmail@gmail.com
IdentityFile ~/.ssh/id_rsa
...
anoff commented

well good thing I figured out where the type error is coming from. I always assumed that people use a keyfile, that's why it tried to read an unspecified path resulting in this error. The catch I introduced recently makes sure that there always is a keyfile used - but I am not really happy with that. But there is something in the dependencies I use that results in a weird state (same you had). I have to work on the error handling for this one.