kukunut0 kukunut0 - 1 year ago 133
Node.js Question

Unable to use "node" command via SSH

I have set up a Ubuntu 14.04 server in Virtual box and installed with node.js.

I could run the command "node server.js" normally in the virtual box.

However, when I use my windows 10 command prompt to connect the server by "ssh user@192.168.x.x" and run "node server.js", it shows up:

The program 'node' can be found in the following packages:

  • node

  • nodejs-legacy

Ask your administrator to install one of them

What should I do?

Answer Source

Most likely due to the way you installed node, it's not in your PATH. This can be due to logging in with a different user than the one you used to install ( that has different path settings ), or it can be due to how the shell is configured w.r.t. login and non-login shells which in essence govern what configuration scripts are sourced and thus what is the value of $PATH.

You could try to run running with:

echo $PATH

Both directly and trough ssh to compare the configuration.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download