22-04-26 Node.js

SOMEmo·2022년 4월 26일
0

ch1. Node.js
Node.js는 chrome V8 JavaScript 엔진으로 빌드된 JavaScript 런타임.(프로그래밍 언어가 동작하는 환경!)
nvm(node version manager)
구글검색: nvm-windows- https://github.com/coreybutler/nvm-windows - download now - nvm-setup.zip

  1. NVM 사용법
    nvm으로 설치된 node.js 확인
nvm ls

nvm으로 node.js 설치

nvm install 12.14.1

nvm으로 사용할 node버전 선택

nvm use 12.14.1

잘 사용되는지 확인

node --version

사용하지 않는 버전 삭제

nvm uninstall 12.21.0

도움말 확인

nvm --help
  1. NPM 개요(1)
    NPM(Node Package Manager)은 전 세계의 개발자들이 만든 다양한 기능(패키지, 모듈)들을 관리.

vscode에서 터미널-npm init -y
-package.json생성 - main은 삭제
npm install parcel-bundler -D
$ npm install lodash
node_modules삭제-npm i

npm install -D xxx: 개발용 의존성 패키지 설치
npm install xxx: 일반 의존성 설치

  1. 개발 서버 실행과 빌드
    $ parcel index.html
    -package.json-scripts-test삭제-"dev": "parcel index.html"
    -$ npm run dev 개발서버 열기
    -main.js - import from 'lodash';
    -console.log(
    .camelCase("hello world"));
    -package.json-"dev": "parcel index.html",
    "build": "parcel build index.html"
    -$ npm run build

  2. 유의적 버전(SemVer=Semactic Versioning)
    Major.Minor.Patch
    12.14.1
    vscode-터미널- $ npm info lodash
    $ npm install lodash@4.17.20
    npm update lodash
    $ npm install lodash@4.17.20

  3. NPM 프로젝트의 버전 관리(.gitignore)
    npm run build
    -새 파일 .gitignore
    .cache/
    dist/
    node_modules/
    -git init~...~commit
    깃허브-new repository- $ git remote add origin https://github.com/lillly02v/test.git
    -git push origin main

0개의 댓글