> For the complete documentation index, see [llms.txt](https://injun-woo30000.gitbook.io/growth-log/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://injun-woo30000.gitbook.io/growth-log/i-learned/node.js-and-express/npx.md).

# npx

라이브 코딩을 보아하니, 모듈을 받을 때 `npm`, `npx`, `yarn` 등을 혼용하는 것처럼 느껴진다. 특히 `Sequelize`를 다룰 때 `npx` 를 많이 쓰기에 이 녀석이 무엇인지 궁금해져 버렸다.

### 그래서 npx는 뭘까?

npx는 새로운 패키지 관리 모듈이 아니라, 자바스크립트 패키지 관리 모듈인 npm(Node Package Module)의 5.2.0 버전부터 새로 추가된 도구이다!

`npx` 명령어를 사용할 수 있다면, npm 레지스트리에 올라가있는 패키지를 쉽게 설치하고 관리할 수 있도록 도와주는 CLI 도구이다.

* npm: Package Manager(관리)
* npx: Package Runner(실행)

### 왜 npx가 도입될 필요가 있었을까?

과거 npm으로 패키지를 설치할 때 두 가지 케이스가 있었다.

1. 전역으로 패키지를 설치하여 의존성 라이브러리들을 전체적을 관리하는 방법
2. 특정 프로젝트에만 의존성 라이브러리를 설치하는 방법

이러한 의존성 라이브러리들이 전역이나 로컬에 설치된 채 관리가 되면 설치된 위치에 따라 따로 관리해줘야한다는 번거로움이 발생한다.

npx는 기존 npm 설치 방법과는 다르게 일일이 설치, 제거를 할 필요 없이 일회성으로 원하는 패키지를 npm 레지스트리에 접근해서 실행시키고 설치하는 실행도구이다. 따로 패키지를 설치하고 업데이트하지 않더라도 npm 레지스트리에 올라가 있는 최신 버전을 실행시키고 설치만 시키면 끝인 셈이다.

[참고](https://webruden.tistory.com/275#:~:text=npx%EB%8A%94%20npm%20%EB%A0%88%EC%A7%80%EC%8A%A4%ED%8A%B8%EB%A6%AC%EC%97%90,%EC%8B%A4%ED%96%89%ED%95%A0%20%EC%88%98%20%EC%9E%88%EA%B2%8C%20%EB%8F%84%EC%99%80%EC%A4%8D%EB%8B%88%EB%8B%A4.)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://injun-woo30000.gitbook.io/growth-log/i-learned/node.js-and-express/npx.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
