---
# System prepended metadata

title: npm、nvm

---

# npm、nvm

## 三者差異
tsc
ts-node
node

## 遇到 npm i 錯誤

```
npm ERR! code ERESOLVE                                        
npm ERR! ERESOLVE could not resolve
...
Could not resolve dependency:
npm ERR! Conflicting peer dependency:

...
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

```

遇到 npm i 錯誤問題，
先刪除 `package-lock.json` 以及 `node_modules`包，重新安裝試試
(等github套件方修好)

## 安裝 NVM

安裝完後記得重開IDE或Terminal才會生效

### Windows

https://github.com/coreybutler/nvm-windows/releases

下載並安裝

### MacOS

    $ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash


## 移除NVM


### Windows

開啟Bash

    $ where nvm
    

    $ cd C:/Users/User/AppData/Roaming/nvm/
    $ ./unins000.exe

![](https://i.imgur.com/zvSweaT.png)


vim ~/.bashrc
移除掉

```bash=
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
```




## nvm使用

### 安裝node版本
nvm install 14.19.3
nvm use 14

### 移除node版本
nvm uninstall 14.19.3
