Node - 1.Overview
Install vnm, node.js, and npm on WSL
nvm
설치
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
nvm install <VERSION>
$ nvm install v16.5.0 --lts
Downloading and installing node v16.5.0...
Downloading https://nodejs.org/dist/v16.5.0/node-v16.5.0-linux-x64.tar.xz...
####################################################################################################################################################################################### 100.0%Computing checksum with sha256sum
Checksums matched!
Now using node v16.5.0 (npm v7.19.1)
Creating default alias: default -> v16.5.0
$ node -v
v16.5.0
npm init
package.json
생성
$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.
See `npm help init` for definitive documentation on these fields
and exactly what they do.
Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
package name: (learnnode) learnnode
version: (1.0.0) 1.0.0
description: project to learn node.js
entry point: (.eslintrc.js)
test command:
git repository: (https://github.com/aimpugn/learnnode.git)
keywords: learn node
author: aimpugn
license: (ISC)
About to write to /mnt/c/Users/daybreak/vscode_projects/project_node/learnnode/package.json:
- 아래와 같이 정리
{
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"name": "learnnode",
"description": "project to learn node.js",
"version": "1.0.0",
"repository": {
"type": "git",
"url": "git+https://github.com/aimpugn/learnnode.git"
},
"keywords": [
"learn",
"node"
],
"author": "aimpugn",
"bugs": {
"url": "https://github.com/aimpugn/learnnode/issues"
},
"homepage": "https://github.com/aimpugn/learnnode#readme",
"devDependencies": {
"eslint": "7.30.0",
"eslint-config-airbnb": "18.2.1",
"eslint-plugin-import": "2.23.4",
"eslint-plugin-jsx-a11y": "6.4.1",
"eslint-plugin-react": "7.24.0",
"eslint-plugin-react-hooks": "4.2.0"
}
}
yarn
설치
npm install -g yarn
vscode
+ eslint
+ prettier
+ airbnb
eslint
학습
Node Cookbook: Discover solutions, techniques and best practices for server-side web development with Node.js 14, 4th Edition
- repo에서 테스트하면서 학습