반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 자바의정석
- 동적계획법
- 빅오 표기법
- 백준단계별로풀어보기
- 다이나믹 프로그래밍
- 알고리즘공부
- 자바공부
- 무료코딩강의
- dp
- 자바
- 개발공부
- ★
- dfs
- 자바의정석연습문제
- 백트래킹
- 무료개발강의
- 자바개념
- 브루트포스
- 자바의정석연습문제풀이
- 백준알고리즘
- 백준9단계
- 코딩공부
- java
- 알고리즘
- 시간 복잡도
- BFS
- 백준자바
- ☆
- Java개념
- 백준
Archives
- Today
- Total
더 많이 실패하기
[React] npm install 및 package.json에 dependencies 추가 본문
반응형
npm install로 dependencies 추가할 때 package.json에도 반영되게 해보자
react 프로젝트 생성 시 기본으로 만들어지는 package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
{
"name": "프로젝트명",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
|
cs |
여기에 필요한 dependencies를 설치해보자!
예시에서는 react-router-dom을 설치한다
1
|
npm install react-router-dom
|
cs |
터미널에 상기 명령어를 입력해주면 되는데, 보통 이런 식으로만 설치한다
하지만 이렇게 하면 package.json은 그대로다..
'--save'를 넣어서 package.json에 반영되도록 해주자
1
|
npm install react-router-dom --save
|
cs |
"react-router-dom": "^6.27.0", 줄이 추가된 걸 볼 수 있다
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
{
"name": "프로젝트명",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.27.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
|
cs |
이렇게 해야 서버에 반영했을 때나 나중에 한번에 설치가 필요할 때(버전이 오래되었을 때 등) npm install 만으로 업데이트 및 설치가 가능해진다
반응형
'개념정리 > 웹 프로그래밍' 카테고리의 다른 글
Comments