討厭的DNS污染

mac重新安裝了系統。

然後要安裝一下nvm 和node,結果真他媽的折騰。

首先運行nvm官網的curl,始終抱錯連結不上。上網搜了下,是DNS污染。

搜索了一下。

https://blog.csdn.net/zz00008888/article/details/123528503

這裏的辦法不錯。

通過 https://www.ipaddress.com/ 获得 raw.githubusercontent.com 的IP地址。

然後去在mac的本機設置hosts

/ect/hosts 一開始是readonly,記得用vim

設置好之後呢,這個就搞定了。

但是呢,github他媽的又有問題了。

配置了github的地址還是不行。

並且這次如圖配置了host也還是不行。

https://blog.csdn.net/m0_64007201/article/details/129628363

搜索到這個解決方案,很棒。

將他的文中的端口號10809 改成你自己的代理端口。

我設置後好之後。

nvm就可以安裝了。

但是安裝好之後,iterm2 重啟後,nvm 還是command not found。

去nvm官網看了下。有這麼一段話:

If you get nvm: command not found after running the install script, one of the following might be the reason:

  • Since macOS 10.15, the default shell is zsh and nvm will look for .zshrc to update, none is installed by default. Create one with touch ~/.zshrc and run the install script again.

我感覺就是我的macOS 太新了。

所以我運行 touch ~/.zshrc 然後重新curl 安裝。

這次終於在安裝好後重啟iterm2 後可以運行nvm了。

然後就是順利安裝node


Posted

in

, ,

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *