지식 공유

프로젝트에 필요한 node_modules 한번에 설치하기

한상규 2020. 7. 6. 15:00

npm install --save

만 쳐주면 된다.

단, package.json 파일의 dependencies에 존재하는 목록만 설치된다.

 

package.json파일은 npm install ~ 해서 설치한 목록이 존재하는 파일이다.

 

내용을 보면 dependencies가 보인다. 이것이 설치한 npm 모듈 목록이다.

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject",
    "test": "jest --watchAll"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "@expo/vector-icons": "~10.0.6",
    "@react-native-community/masked-view": "0.1.6",
    "@react-navigation/bottom-tabs": "^5.3.1",
    "@react-navigation/drawer": "^5.7.2",
    "@react-navigation/native": "^5.3.0",
    "@react-navigation/stack": "^5.2.16",
    "expo": "~37.0.9",
    "expo-asset": "~8.1.0",
    "expo-cli": "^3.20.3",
    "expo-constants": "~9.0.0",
    "expo-font": "~8.1.0",
    "expo-linking": "^1.0.1",
    "expo-splash-screen": "^0.2.3",
    "expo-web-browser": "~8.2.0",
    "react": "~16.9.0",
    "react-dom": "~16.9.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz",
    "react-native-gesture-handler": "~1.6.0",
    "react-native-pull-to-refresh": "^2.1.3",
    "react-native-reanimated": "~1.7.0",
    "react-native-safe-area-context": "0.7.3",
    "react-native-screens": "~2.2.0",
    "react-native-swipe-list-view": "^3.1.0",
    "react-native-web": "~0.11.7"
  },
  "devDependencies": {
    "@babel/core": "^7.8.6",
    "babel-preset-expo": "~8.1.0",
    "jest-expo": "~37.0.0"
  },
  "private": true
}

 

위 예시를 보면 

npm install @expo/vector-icons

npm install @react-native-community/masked-view

.

.

.

npm install react-native-web

이런 것들이 설치된 프로젝트라는 것을 알 수 있다.