====== nvm을 이용한 여러버전의 node.js관리하지 ====== ==== Linux ==== curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash -- 또는 curl -s -o- https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash ==== macOS ==== brew install nvm ==== Windows ==== https://github.com/coreybutler/nvm-windows#installation--upgrades nvm설치를 먼저한다. 그리고 nvm install 18 nvm use 18 ==== nvm 사용하여 node.js 설치 ==== nvm ls-remote <-- 설치가능한 목록 nvm ls <-- 설치된 목록 === node 설치 === nvm install --lts=gallium nvm install --lts=hydrogen nvm install --lts <-- 최신 LTS버전을 설치 === node 버전 전환 === nvm use 18 nvm use 16 nvm use system ====== Node.js ====== Node.js는 확장성 있는 네트워크 애플리케이션(특히 서버 사이드) 개발에 사용되는 소프트웨어 플랫폼이다. 작성 언어로 자바스크립트를 활용하며 Non-blocking I/O와 단일 스레드 이벤트 루프를 통한 높은 처리 성능을 가지고 있다. 내장 HTTP 서버 라이브러리를 포함하고 있어 웹 서버에서 아파치 등의 별도의 소프트웨어 없이 동작하는 것이 가능하며 이를 통해 웹 서버의 동작에 있어 더 많은 통제를 가능케 한다 ===== nodejs INSTALL ===== Node.js LTS(v16.x) : # Using Ubuntu curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - sudo apt-get install -y nodejs # Using Debian, as root curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - apt-get install -y nodejs Node.js 현재(v18.x) : # Using Ubuntu curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash - sudo apt-get install -y nodejs # Using Debian, as root curl -fsSL https://deb.nodesource.com/setup_current.x | bash - apt-get install -y nodejs ===== npm (Node Package Manager) ===== npm (노드 패키지 매니저/Node Package Manager)은 자바스크립트 프로그래밍 언어를 위한 패키지 관리자이다. 자바스크립트 런타임 환경 Node.js의 기본 패키지 관리자이다. 명령 줄 클라이언트(npm), 그리고 공개 패키지와 지불 방식의 개인 패키지의 온라인 데이터베이스(npm 레지스트리)로 이루어져 있다. 이 레지스트리는 클라이언트를 통해 접근되며 사용 가능한 패키지들은 npm 웹사이트를 통해 찾아보고 검색할 수 있다. 패키지 관리자와 레지스트리는 npm사에 의해 관리된다. ==== Windows modules Directory ==== 나의 PC에 있는 node_modules위치는 C:\Users\taekg\AppData\Roaming\npm\node_modules ==== 주요 modules 설치 ==== npm install -g typescript npm install -g @angular/cli npm install -g eslint npm install -g create-react-app ==== install시 옵션 ==== CLI을 통한 설치시 --save, --save-dev옵션의 차이 npm install mocha --save npm install mocha --save-dev --save는 package.json의 dependencies에 추가하며 --save-dev는 package.json의 dev-Dependencies에 추가된다. ====== Node.js Update ====== 1.Node.js 의 패키지매니저인 npm 을 이용해서 대부분의 플러그인을 설치하는데요. 캐시가 남아있는 경우 에러가 날 수 있다고 합니다. 캐시를 미리 삭제해줍니다. $ sudo npm cache clean -f 2.n설치 $ sudo npm install -g n 3.npm 설치하기 $ sudo n [latest|stable|lts|version] 4.npm 버전선택 단순히 n을 입력하면 설치된 node.js버전을 확인 할 수 있고 그중에 선택할 수 있다. $ sudo n ==== MacOS ==== brew update brew upgrade node 현재설치된 소프트웨어 brew list 설치가능한 목록 brew search node 버전별설치 brew install node@18 ==== React Application 시작 ==== * Node.js * 최신버전확인 * npm -v * node -v * npm upgrade * sudo npm install -g npm * Project 생성방법 - Node.js최신버전확인 * npm -v * sudo npm install -g npm - create-react-app * npm install -g create-react-app - create PROJECT - create-react-app boeun - 확인 - npm start - http://localhost:3000에서 확인하세요.