mac从零配置前端环境

下载的内容有nvm node.js npm vscode homebrew nginx。

下载nvm

国内镜像源

配置镜像源

输入命令vim /etc/hosts 输入i将下面内容拷贝进去,Ese :wq保存退出。

# GitHub520 Host Start
140.82.114.26                 alive.github.com
140.82.112.5                  api.github.com
185.199.111.153               assets-cdn.github.com
185.199.110.133               avatars.githubusercontent.com
185.199.110.133               avatars0.githubusercontent.com
185.199.110.133               avatars1.githubusercontent.com
185.199.110.133               avatars2.githubusercontent.com
185.199.110.133               avatars3.githubusercontent.com
185.199.110.133               avatars4.githubusercontent.com
185.199.110.133               avatars5.githubusercontent.com
185.199.110.133               camo.githubusercontent.com
140.82.112.21                 central.github.com
185.199.108.133               cloud.githubusercontent.com
140.82.114.9                  codeload.github.com
140.82.113.21                 collector.github.com
185.199.110.133               desktop.githubusercontent.com
185.199.110.133               favicons.githubusercontent.com
140.82.114.3                  gist.github.com
54.231.132.201                github-cloud.s3.amazonaws.com
52.217.159.33                 github-com.s3.amazonaws.com
16.182.70.201                 github-production-release-asset-2e65be.s3.amazonaws.com
52.217.71.156                 github-production-repository-file-5c1aeb.s3.amazonaws.com
52.216.77.12                  github-production-user-asset-6210df.s3.amazonaws.com
192.0.66.2                    github.blog
140.82.114.3                  github.com
140.82.112.17                 github.community
185.199.110.154               github.githubassets.com
151.101.1.194                 github.global.ssl.fastly.net
185.199.110.153               github.io
185.199.108.133               github.map.fastly.net
185.199.110.153               githubstatus.com
140.82.114.26                 live.github.com
185.199.108.133               media.githubusercontent.com
185.199.110.133               objects.githubusercontent.com
13.107.42.16                  pipelines.actions.githubusercontent.com
185.199.108.133               raw.githubusercontent.com
185.199.108.133               user-images.githubusercontent.com
13.107.213.40                 vscode.dev
140.82.112.21                 education.github.com

# Update time: 2023-12-09T12:05:19+08:00
# Update url: https://raw.hellogithub.com/hosts
# Star me: https://github.com/521xueweihan/GitHub520
# GitHub520 Host End

输入curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

下载nvm管理工具。一次不行就多试几次。

安装后,可能需要配置环境变量。

输入vim ~/.bashrc 将下面内容输入进去。然后输入source ~/.bashrc 重启一下配置,关闭终端重新打开。

若mac默认是zsh用户,则需要输入vim ~/.zshrc,重复以上步骤即可。

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

安装node.js

在nvm安装好的前提下,输入nvm ls-remote查看node.js版本。输入nvm install v16.xx.xx版本的node.js进行安装,安装好后,输入node -v , npm -v查看版本号。

查看本地安装版本 nvm ls;

切换默认版本号:nvm alias default v16.xx.xx

安装vscode

网站:https://code.visualstudio.com/Download

插件推荐 Live server

homebrew安装

安装命令:/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

卸载命令:/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh)"

nginx安装

命令:brew install nginx

启动nginx命令:brew services start nginx

在浏览器中输入http://localhost:8080/查看是否安装成功

  • 8
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值