关于mac从0搭建开发环境

1. item安装

https://www.jianshu.com/p/ba08713c2b19  或   

https://www.jianshu.com/p/bb630ada1f02   或

https://zhuanlan.zhihu.com/p/37195261  

2. node版本切换工 n

sudo npm install n -g

3. 安装brew

https://brew.sh/index_zh-tw

若报错:curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused

解决方案(一):

https://medium.com/@weixiao_6070/%E5%85%B3%E4%BA%8Emac%E4%B8%8B%E8%BD%BDbrew%E6%8A%A5curl-7-failed-to-connect-to-raw-githubusercontent-com-port-443-connection-refused-2293c50b7ff

解决方案(二)

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

选择清华大学下载源,学校的比较快

https://blog.csdn.net/yuanshangshenghuo/article/details/106599836


4.启动项目时报错,Error: EACCES: permission denied,必须每次前面加上sudo才行,比如 sudo npm run dev:h5 等等

解决方案,在【根目录 ~/ 】下执行命令   sudo chown -R $(whoami) ~/.npm,即可~

5. mac 调试ios移动端页面

https://blog.csdn.net/Android_liangyi/article/details/80928891


6. mac 展示所有显示/隐藏文件

显示

defaults write com.apple.finder AppleShowAllFiles -boolean true;killall Finder

隐藏

defaults write com.apple.finder AppleShowAllFiles -boolean false;killall Finder

参考:https://jingyan.baidu.com/article/e8cdb32beec90337052bad89.html


7. vscode操作文件总是提示权限不足

在父级文件夹下 ,执行  

sudo chmod -R 777 ‘文件夹名称’


8. mac 修改host

https://www.jianshu.com/p/3d4bdf180bd6

mac switchhost安装包

https://github.com/oldj/SwitchHosts/releases/download/v3.5.4/SwitchHosts._macOS_3.5.4.5517.dmg


9. mac连上wifi却无法上网

https://blog.csdn.net/lyxleft/article/details/79971963

10. npm 安装成功的东西,总是提示权限不足,如安装xxxx成功后,提示 `command not found: xxxx`

配置环境变量并source一下

echo -e "export PATH=$(npm prefix -g)/bin:$PATH" >> ~/.npmrc && source ~/.npmrc

参考:https://blog.csdn.net/weixin_44491842/article/details/121724738

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。