Install nodejs on ec2 remote ssh workspace using c9/install.sh

ssh
workspace
nodejs

#1

To create an ssh workspace I launched an EC2 instance and tried installing NodeJS in it using:
$ curl -L https://raw.githubusercontent.com/c9/install/master/install.sh | bash

The output was:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 11980  100 11980    0     0  54736      0 --:--:-- --:--:-- --:--:-- 54954
Installing base packages. Use --help for more options
:Installing Node v4.4.6
--2017-08-09 22:58:04--  https://nodejs.org/dist/v4.4.6/node-v4.4.6-linux-x64.tar.gz
Resolving nodejs.org (nodejs.org)... 104.20.23.46, 104.20.22.46, 2400:cb00:2048:1::6814:162e, ...
Connecting to nodejs.org (nodejs.org)|104.20.23.46|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12174079 (12M) [application/gzip]
Saving to: β€˜node.tar.gz’

100%[======================================>] 12,174,079  23.5MB/s   in 0.5s   

2017-08-09 22:58:05 (23.5 MB/s) - β€˜node.tar.gz’ saved [12174079/12174079]


real	0m2.108s
user	0m1.308s
sys	0m0.219s
:Installing TMUX
:Existing tmux version is up-to-date

real	0m0.023s
user	0m0.014s
sys	0m0.009s
:Installing Nak
npm WARN excluding symbolic link tests/filelist_fixtures/symlink-to-1.txt -> 1.txt
npm WARN excluding symbolic link tests/filelist_fixtures/symlink-to-nowhere.txt -> nowhere.txt
npm WARN excluding symbolic link tests/search_fixtures/symlink-to-file1.txt -> file1.txt
npm WARN excluding symbolic link tests/filelist_fixtures/symlink-to-1.txt -> 1.txt
npm WARN excluding symbolic link tests/filelist_fixtures/symlink-to-nowhere.txt -> nowhere.txt
npm WARN excluding symbolic link tests/search_fixtures/symlink-to-file1.txt -> file1.txt
npm WARN engine simplefunc@0.0.2: wanted: {"node":">= 0.6.0 && < 0.9.0"} (current: {"node":"4.4.6","npm":"2.15.5"})
nak@0.3.3 node_modules/nak
β”œβ”€β”€ simplefunc@0.0.2
β”œβ”€β”€ colors@0.6.2
└── isbinaryfile@2.0.0

real	0m1.858s
user	0m1.132s
sys	0m0.096s
:Installing pty.js
--2017-08-09 22:58:08--  https://github.com/c9/install/releases/download/bin/pty-v4.4.6-linux-x64.tar.gz
Resolving github.com (github.com)... 192.30.253.113, 192.30.253.112
Connecting to github.com (github.com)|192.30.253.113|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://github-production-release-asset-2e65be.s3.amazonaws.com/15140384/76ba15bc-3b57-11e6-8100-238bb52ef108?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20170809%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20170809T225808Z&X-Amz-Expires=300&X-Amz-Signature=1923ce4ba83c1ab89eb62cf50925846b57c9ec1c7a2185d7b56f4e0a210c127c&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dpty-v4.4.6-linux-x64.tar.gz&response-content-type=application%2Foctet-stream [following]
--2017-08-09 22:58:08--  https://github-production-release-asset-2e65be.s3.amazonaws.com/15140384/76ba15bc-3b57-11e6-8100-238bb52ef108?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20170809%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20170809T225808Z&X-Amz-Expires=300&X-Amz-Signature=1923ce4ba83c1ab89eb62cf50925846b57c9ec1c7a2185d7b56f4e0a210c127c&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dpty-v4.4.6-linux-x64.tar.gz&response-content-type=application%2Foctet-stream
Resolving github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)... 54.231.97.208
Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|54.231.97.208|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 29252 (29K) [application/octet-stream]
Saving to: β€˜pty.js.tar.gz’

100%[======================================>] 29,252      --.-K/s   in 0.01s   

2017-08-09 22:58:08 (2.00 MB/s) - β€˜pty.js.tar.gz’ saved [29252/29252]


real	0m0.299s
user	0m0.051s
sys	0m0.020s
:Installing Collab Dependencies
/
> sqlite3@3.1.4 install /home/ubuntu/.c9/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build

[sqlite3] Success: "/home/ubuntu/.c9/node_modules/sqlite3/lib/binding/node-v46-linux-x64/node_sqlite3.node" is installed via remote
sqlite3@3.1.4 node_modules/sqlite3
└── nan@2.3.5
npm WARN deprecated lingo@0.0.5: This project is abandoned
sequelize@2.0.0-beta.0 node_modules/sequelize
β”œβ”€β”€ commander@2.0.0
β”œβ”€β”€ promise@3.2.0
β”œβ”€β”€ toposort-class@0.2.1
β”œβ”€β”€ generic-pool@2.0.4
β”œβ”€β”€ dottie@0.0.8-0
β”œβ”€β”€ lingo@0.0.5
β”œβ”€β”€ validator@1.5.1
β”œβ”€β”€ lodash@1.3.1
β”œβ”€β”€ underscore.string@2.3.3
β”œβ”€β”€ moment@2.1.0
└── sql@0.26.0 (sliced@0.0.5)
--2017-08-09 22:58:15--  https://raw.githubusercontent.com/c9/install/master/packages/sqlite3/linux/sqlite3.tar.gz
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.124.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.124.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4350866 (4.1M) [application/octet-stream]
Saving to: β€˜sqlite3.tar.gz’

100%[======================================>] 4,350,866   18.7MB/s   in 0.2s   

2017-08-09 22:58:16 (18.7 MB/s) - β€˜sqlite3.tar.gz’ saved [4350866/4350866]


real	0m7.647s
user	0m5.006s
sys	0m0.613s
~/.c9/node_modules/.bin ~/.c9/lib
~/.c9/lib
:Done.

But then the c9 remote ssh workspace couldn’t lunch with the message bash: node: command not found and on the remote EC2 server node didn’t get installed:

$ node -v
The program 'node' can be found in the following packages:
 * node
 * nodejs-legacy
Try: sudo apt-get install <selected package>

What is the easiest way to install nodejs on the remote server?


#2

nvm is usually the simplest way https://github.com/creationix/nvm.

But if you do not need node, and are seeing the error when creating a new workspace, you also can set the node path to ~/.c9/node/bin/node