Only for Linux. Mainly Debian-based distros. I'm sorry. I will add support for RPM and DNF-based distros soon. Open issues here
Last active
September 6, 2021 08:30
-
-
Save im-coder-lg/a2b7c63a513d746b18f9e0f45bd4dd84 to your computer and use it in GitHub Desktop.
Install Node JS LTS/Latest via a simple shell script.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "What version of Node JS do you want? The LTS or the latest release?" | |
echo "Respond with LTS or latest(case sensitive)" | |
read versionofnode | |
if [ "$versionofnode" = "LTS" ]; then | |
sudo apt-get install curl software-properties-common | |
curl -sL https://deb.nodesource.com/setup_14.x | sudo bash - | |
sudo apt install nodejs | |
node -v && npm -v | |
fi | |
if [ "$versionofnode" = "latest" ]; then | |
sudo apt-get install curl software-properties-common | |
curl -sL https://deb.nodesource.com/setup_16.x | sudo bash - | |
sudo apt install nodejs | |
node -v && npm -v | |
fi | |
# wip | |
echo "Node JS is installed. Do you want to test it?" | |
echo "Respond with yes or no(case sensitive)" | |
read test | |
if [ "$test" = "yes" ]; then | |
mkdir tmp | |
cd tmp | |
wget https://raw.githubusercontent.com/im-coder-lg/special-projects/master/install-nodejs/server-test.js --no-check-certificate | |
node server-test.js | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
http.createServer(function (req, res) { | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
res.end('Hello World\n'); | |
}).listen(3000, "127.0.0.1"); | |
console.log('Server running at http://127.0.0.1:3000/'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
chore:
wget
command for test