> For the complete documentation index, see [llms.txt](https://mm.ricky.moe/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mm.ricky.moe/frontend-ecosystem/npm/npm-global-path.md).

# 全局安装目录

> 在我的 Mac 机器上，没有配置全局安装目录，会出现 npm global install 后找不到命令的情况，因此来记录一下npm 如何进行全局安装目录的配置。

回到用户根目录下再新建一个全局安装的路径

```bash
cd ~
mkdir ~/.npm-global
```

配置npm使用新的路径

```
vim ~/.zshrc
```

在最后一行添加环境变量申明，即可导入 npm global intsall 的全局路径

```
export PATH=~/.npm-global/bin:$PATH
```

使配置生效

```
source ~/.zshrc
```


---

# 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://mm.ricky.moe/frontend-ecosystem/npm/npm-global-path.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.
