본문 바로가기
WEB/JavaScript

[JS] NPM

by DeveloperCat 2023. 10. 23.
반응형

 Node.js 설치하면 같이 설치되 사용할  있습니다. npm에는 Node.js에서 사용되는 각종 코드 패키지들이 모여있고, 우리는  패키지를 다운로드 받아 사용할  있습니다.   쉽게 npm Node.js 생태계의 앱스토어나 플레이스토어 같은 역할을 합니다.

 

자주 사용하는 npm 명령어

package.json 생성

$ npm init

# 기본 설정

$ npm init -y

패키지 설치

# 로컬 설치

$ npm install <package-name>

# 전역 설치

$ npm install -g <package-name>

# 개발 설치

$ npm install --save-dev <package-name>

# package.json 모든 패키지 설치

$ npm install

패키지 제거

# 로컬/개발 패키지 제거

$ npm uninstall <package-name>

# 전역 패키지 제거

$ npm uninstall -g <package-name>

패키지 업데이트

$ npm update <package-name>

전역 설치 패키지 확인

$ npm ls -g --depth=0

package.json scripts 프로퍼티의 start 실행

$ npm start

package.json scripts 프로퍼티의 start 이외의 scripts 실행

$ npm run <script-name>

전역 패키지 설치 폴더 확인

$ npm root -g

/usr/local/lib/node_modules

# 파인더 오픈

$ open /usr/local/lib/node_modules

패키지 정보 참조

$ npm view <package-name>

# react-create-app 패키지 정보 확인

$ npm view react-create-app

 

 

react-create-app@2.0.6 | MIT | deps: 19 | versions: 19

This helper exports a function returning a ready-to-use React App component with the following: - react-router-redux - history - redux-persist

 

 

dist

.tarball: https://registry.npmjs.org/react-create-app/-/react-create-app-2.0.6.tgz

.shasum: 88b10bc9a53e58a8b08b7a4cdf8cd6b21f8113fe

.integrity: sha512-YT8WiWx9wuJFM35EyW/Z9R/75MYj3hW9DsT7f1Dj6M3bdTRnWOocOh9r4HkM5OKFQDzZwTvyQrzITTEn6JxCqg==

 

 

dependencies:

babel-eslint: 7.2.3

babel-jest: 20.0.3

babel-loader: 7.1.2

babel-plugin-transform-class-properties: 6.24.1

babel-plugin-transform-decorators-legacy: 1.3.4

babel-preset-env: next

babel-preset-react: 6.24.1

babel-preset-stage-0: 6.24.1

eslint-loader: 1.9.0

eslint-plugin-import: 2.7.0

eslint-plugin-jest: 20.0.3

eslint-plugin-react: 7.3.0

eslint: 4.5.0

prop-types: 15.5.10

react-redux: 5.0.6

react: 15.6.1

redux-persist-crosstab: 3.6.0

redux-persist: 4.9.1

redux: 3.7.2

 

 

maintainers:

- damianobarbati <damiano@mvpbld.com>

 

 

dist-tags:

latest: 2.0.6

 

 

published over a year ago by damianobarbati <damiano@mvpbld.com>

# eslint-config-airbnb 함께 설치해야 하는 다른 패키지 확인

$ npm view eslint-config-airbnb@latest peerDependencies

 

 

{

  eslint: '^5.16.0 || ^6.1.0',

  'eslint-plugin-import': '^2.18.2',

  'eslint-plugin-jsx-a11y': '^6.2.3',

  'eslint-plugin-react': '^7.14.3',

  'eslint-plugin-react-hooks': '^1.7.0'

}

버전 확인

$ npm -v

npm 명령어 설명 참조

$ npm help <command>

반응형

'WEB > JavaScript' 카테고리의 다른 글

[JS] ECMA스크립트  (0) 2023.10.23
[js] Parcel 번들러  (0) 2023.10.23
[JS] Node.js  (0) 2023.10.23
[JS] […]  (0) 2023.10.23
[JS] stopPropagation  (0) 2023.10.23