Ubuntu 安裝/測試 nodejs [How To Install Node JS In Ubuntu Linux]

Ubuntu 安裝/測試 nodejs [How To Install Node JS In Ubuntu Linux]

Ubuntu 安裝/測試 nodejs [How To Install Node JS In Ubuntu Linux]


資料來源: https://www.youtube.com/watch?v=II7L8rpJ_6g

https://github.com/nodesource/distributions/blob/master/README.md
https://nodejs.org/en/about/


GITHUB:https://github.com/jash-git/How-To-Install-Node-JS-In-Ubuntu-Linux


$sudo apt-get install curl
$sudo apt-get install python-software-properties
#curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
$curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
$sudo apt-get update
$sudo apt-get install -y nodejs
$nodejs -v
$npm -v
$gedit app.js
	const http = require('http');

	const hostname = '127.0.0.1';
	const port = 3000;

	const server = http.createServer((req, res) => {
	  res.statusCode = 200;
	  res.setHeader('Content-Type', 'text/plain');
	  res.end('Hello World\n');
	});

	server.listen(port, hostname, () => {
	  console.log(`Server running at http://${hostname}:${port}/`);
	});
$nodejs app.js	

2 thoughts on “Ubuntu 安裝/測試 nodejs [How To Install Node JS In Ubuntu Linux]

  1. 紀錄:

    01.在LINUX VPS 上 按照步驟實作依序實作 可以正確安裝 12.x 版的Node.js

    02.確定可以正確運行app.js

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *