Notice
Recent Comments
Link
Tags
- npm버전확인
- mysql index 생성
- java 숫자를 문자로 변환하기
- Node.js express install
- 우분투 node js 설치
- 우분투 시간변경
- express install
- Ubuntu timezone
- raspi-config
- C언어
- 디지털오션 클라우드서버 생성하기
- ubuntu node js install
- tzselect
- 자바 파일 한줄씩 읽기
- ubuntu node js
- Python
- 디지털오션 드로플릿
- 클라우드서버 생성
- node js express install
- 우분투 시간설정
- 자바 한줄씩 읽기
- node js 버전확인
- node 버전확인
- c언어 파일 읽기
- index 생성
- c file read
- 라즈베리파이4
- 파이썬 반복문
- 디지털오션 서버생성하기
- 파이썬
Archives
- Today
- Total
호그래머
라즈베리파이4(Raspberry Pi 4 Model B) Node.js(V12.18.3) 설치 20.08.02 본문
728x90
라즈베리파이 Node.js 설치
1. sudo apt-get update
2. sudo apt-get install curl (이미 설치 됨)
3. curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
4. sudo apt-get install nodejs
5. 설치 완료 확인
nodejs -v
Node.js 버전 확인
npm -v
npm 버전 확인
6. 간단예제 실행(웹 서버)
소스코드 - hello_world.js
const http = require('http');
const hostname = '192.168.0.7';
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}/`);
});
hellow_world.js 라즈베리파이 pi폴더로 이동
node hello_world.js 명렁으로 실행
웹브라우저에서 hello_world 서버 접속 192.168.0.7:3000
끝
1. 라즈베리파이에 Node.js를 설치하였습니다.
2. npm은 패키지 관리자 입니다.
2. 현재 Node.js 최신 버전은 14.x 안정적 지원 버전은 12.x 입니다.
3. 짧은 소스코드로 웹서버를 단시간안에 구축할 수 있습니다.
참고링크
https://github.com/nodesource/distributions/blob/master/README.md
https://nodejs.org/dist/latest-v12.x/docs/api/synopsis.html
728x90
'Raspberry Pi' 카테고리의 다른 글
라즈베리파이4(Raspberry Pi 4 Model B) root 계정설정 20.08.10 (0) | 2020.08.10 |
---|---|
라즈베리파이4(Raspberry Pi 4 Model B) MariaDB(MySQL) 설치 20.08.05 (0) | 2020.08.05 |
라즈베리파이4(Raspberry Pi 4 Model B) 기본세팅 비민번호 변경 20.07.31 (0) | 2020.07.31 |
라즈베리파이4 (Raspberry Pi 4 Model B) 기본세팅 시간설정 20.07.29 (0) | 2020.07.29 |
라즈베리파이4 (Raspberry Pi 4 Model B) 기본세팅 원격설정 20.07.29 (0) | 2020.07.29 |
Comments