用charles抓取请求的时候,charles总是抓不到localhost:3000发出的请求,也就没办法模拟数据,
官网说什么要在charles模拟本地数据的时候域名用localhost_charlesproxy_com。(_&.)
然而很不幸的是,我本地localhost_charlesproxy_com::3000本启动不起来项目,所以只能修改react项目的默认域名,在react项目的package.json文件中将原来的"start": “react-scripts start”, 这一句改为"set PORT=3000 HOST=localhost_charlesproxy_com && react-scripts start",项目的本地启动地址就变成了了localhost_charlesproxy_com::3000。此时再用charles模拟数据就成功了。
[charles开启Charles-Proxy-macOS Proxy 时报错]
Charles cannot configure your proxy settings while it is on a read-only volume. Perhaps you are running Charles from the disk image? If so, please copy Charles to the Applications folder and run it again. Otherwise please ensure that Charles is writable by the current user and try again.
解决:
终端输入后重启
sudo chown -R root "/Applications/Charles.app/Contents/Resources"
sudo chmod -R u+s "/Applications/Charles.app/Contents/Resources"
网友评论