手机浏览 RSS 2.0 订阅 膘叔的简单人生 , 腾讯云RDS购买 | 超便宜的Vultr , 注册 | 登陆
浏览模式: 标准 | 列表全部文章

aliyun composer 镜像可能有问题

 好几次遇到阿里云的镜像更新有问题了,明明某个库有了最新版,但阿里云就是报版本不存在。今天又出现了这样的情况,安装laravel-zero的时候,require-dev中有个laravel/pint ^1.2,直接就报了

 
  Problem 1
    - Root composer.json requires laravel/pint ^1.2, found laravel/pint[dev-main, v0.1.0, ..., v0.2.4, v1.0.0, ..., v1.1.3] but it does not match the constraint.
 
问题是这个laravel/pint 的github上,1.2的release是 9月13日啊。(laravel/pint: Laravel Pint is an opinionated PHP code style fixer for minimalists. (github.com))。
 
由于之前也遇到过这个问题,当时是unset掉 aliyun镜像,换成了官方镜像,但确实是慢,所以我就看了一眼其他镜像,比如以前常用的https://packagist.phpcomposer.com,在国内没有其他镜像的时候,它做了很大的贡献,然而也太不稳定了。直接报:

Problem 1 - Root composer.json requires laravel-zero/framework, it could not be found in any version, there may be a typo in the package name. Problem 2 - Root composer.json requires nunomaduro/termwind, it could not be found in any version, there may be a typo in the package name. Problem 3 - Root composer.json requires laravel/pint, it could not be found in any version, there may be a typo in the package name. Problem 4 - Root composer.json requires mockery/mockery, it could not be found in any version, there may be a typo in the package name. Problem 5 - Root composer.json requires pestphp/pest, it could not be found in any version, there may be a typo in the package name. Potential causes: - A typo in the package name - The package is not available in a stable-enough version according to your minimum-stability setting see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details. - It's a private package and you forgot to add a custom repository to find it Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

看来,已经多年没有更新过了,真可惜了。
最后在这里找到了:国内 PHP Composer 镜像列表 - 腾讯云开发者社区-腾讯云 (tencent.com),列表中的那些镜像,象最后的安畅网络的,网址都崩了。所幸,腾讯的还能用。
打开:腾讯软件源 (tencent.com),搜到composer,看一下帮助(真简单就两句话),一句教你配置,一句教你下载。
配好之后,composer u,完成。记录一下
 
 
1、阿里:composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
2、腾讯:composer config -g repos.packagist composer https://mirrors.tencent.com/composer/
3、清除:composer config -g --unset repos.packagist
 
带 -g 的是全局的,不带  -g,就是当前项目了。
 

 

又做了一次服务网站的迁移

在很久很久以前,我其实一直是使用阿里云的,直到后面腾讯也出了云。当然使用量明显没有阿里大,而且我还一直是推荐阿里的。

由于国内的一些原因,有些网站没法备案(比如个人网站,还不能介绍自己做的项目,只能用公司网站。。),所以,部分网站采用了香港的服务器。
 
在早些年吧,用aws的lightsail,便宜,但没有香港区,只有:日本、韩国、新加坡,这些地区吧,白天访问都挺正常,一到晚上就开始抽风,于是几乎全部撤出,采用阿里云香港。
前两年都挺OK。好象从21年起,阿里云香港也开始逐步抽风了,最高的时候丢包率达到了25%左右,白天也是一切正常。
 
因此只能想办法再尝试尝试换了。这次就换到腾讯去了,看看效果如何。
--
话说从03年到现在,也算是用了不少服务器了。
04~05,自己买AMD的芯片组装的windows服务器,托管在上海漕河泾,后因为那边经常断电烧坏了
08年开始,买了朋友的一台dell的2U,托管在edong,也是因为他们迁机房的问题,导致我整个断网2个月,alexa排名从1万掉到10万开外,就再也没有恢复过
11年开始使用linode,然后就是各种其他的大大小小的、知名的不知名的服务器都在尝试,感觉就是在不停踩坑
用过GCP、AWS,还有盛大云、DO,OVH的等。后面因为开始做外包,慢慢全部不再使用,直接用国内的阿里云,这两年在慢慢切回腾讯云。
 
有几个小原因,比如备案,你在A站备案,到腾讯还是不能使用2级域名。必须要在他那边备案,所以才不得不使用香港主机,先用起来,后面备案再切。所幸现在的网站都是git来git去的。基本上部署一个网站也就半小时就行了。
 
没用docker,PHP用docker感觉没啥大意义。之前用过,因为要跑不同的PHP版本,从5.6~8都有,那时候不得不用docker。现在基本上都以7.4为主,即使上8也不会有大问题,所以不再使用Docker了。
 
废话说的太多了,睡觉~

uniapp backgroundImage 无法显示

突然发现uniapp好象无法分类。

用uniapp的时候突然发现使用背景图的时候打包无法打进去。本来这也没多大事,毕竟所有的图片几乎都是从网上拉过来的。但只是一个背景色也要从网上下载就有点麻烦了。所以就看了一下
1、如果不是变量的,得用相对路径,比如 /static/background.png,要写成 ../../static,注意当前文件和static的相对路径
2、如果是变量的,得一一require进来。然后用变量与require的对量对应
3、或者你还是用image标签,但是这个image标签外用view做好对应,如果上面有堆叠其他内容,会相对比较麻烦一点
4、还是用网上的地址吧,尽量使用云存储,不然如果是小水管网站,这么一拉取,其他内容可能变被卡住了。
 
基本上就这么些方法。

Tunnel error on MacOS when installed as service

其实我一直在想,这个功能什么时候会被关掉。

 
开始:
用cloudflare tunnel的时候,从没想过会在macos上出问题,如果你直接cloudflared service install,不会运行,即使你sudo了也不会,因为这个运行的只是cloudflared,并不带任何参数。
需要在相应的plist下面加上<string>tunnel</string><string>run</string>才OK。
加之前需要先unload,然后再load。否则无效。
其他都与官方一致。
 
---
如果用sudo了。需要将~/.cloudflared/下的内容copy到/etc/cloudflared下面。如果不放心或者担心没权限,可以修改uuid.json,将路径改为/etc/cloudflared/。其他照旧
 
记得配合一下valet,因为valet tld之后,子域名的映射会比较方便。
而且valet也支持multi php version。
 
---EOF
 

git fetch --unshadow出现RPC failed

 远程操作家里的mac mini进行更新的时候,突然报错:

XML/HTML代码
  1. mini:Homebrew mini$ brew update  
  2. Warning: No available formula with the name "ca-certificates".  
  3. ==> Searching for similarly named formulae...  
  4. Error: No similarly named formulae found.  
  5. ==> Searching for a previously deleted formula (in the last month)...  
  6. Warning: homebrew/core is shallow clone. To get its complete history, run:  
  7.   git -C "$(brew --repo homebrew/core)" fetch --unshallow  
  8.   
  9. Error: No previously deleted formula found.  
  10. ==> Searching taps on GitHub...  
  11. Error: No formulae found in taps.  
  12. Error:  
  13.   homebrew-core is a shallow clone.  
  14. To `brew update`, first run:  
  15.   git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow  
  16. This command may take a few minutes to run due to the large size of the repository.  
  17. This restriction has been made on GitHub's request because updating shallow  
  18. clones is an extremely expensive operation due to the tree layout and traffic of  
  19. Homebrew/homebrew-core and Homebrew/homebrew-cask. We don't do this for you  
  20. automatically to avoid repeatedly performing an expensive unshallow operation in  
  21. CI systems (which should instead be fixed to not use shallow clones). Sorry for  
  22. the inconvenience!  
于是执行 git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow  ,然而执行下来还是:
XML/HTML代码
  1. error: RPC failed; HTTP 504 curl 22 The requested URL returned error: 504 Gateway Time-out  
  2. fatal: the remote end hung up unexpectedly  
 
然后我就用打开git trace进行查看:
XML/HTML代码
  1. GIT_TRACE=2 git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow  
  2. 10:29:28.798061 exec-cmd.c:139          trace: resolved executable path from Darwin stack: /Applications/Xcode.app/Contents/Developer/usr/bin/git  
  3. 10:29:28.798668 exec-cmd.c:236          trace: resolved executable dir: /Applications/Xcode.app/Contents/Developer/usr/bin  
  4. 10:29:28.799328 git.c:418               trace: built-in: git fetch --unshallow  
  5. 10:29:28.801482 run-command.c:643       trace: run_command: GIT_DIR=.git git-remote-https origin https://mirrors.ustc.edu.cn/homebrew-core.git  
  6. 10:29:28.812513 exec-cmd.c:139          trace: resolved executable path from Darwin stack: /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git-remote-https  
  7. 10:29:28.813122 exec-cmd.c:236          trace: resolved executable dir: /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core  
  8. 10:29:28.929816 run-command.c:643       trace: run_command: git fetch-pack --stateless-rpc --stdin --lock-pack --include-tag --thin --depth=2147483647 https://mirrors.ustc.edu.cn/homebrew-core.git/  
  9. 10:29:28.935164 exec-cmd.c:139          trace: resolved executable path from Darwin stack: /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git  
  10. 10:29:28.935863 exec-cmd.c:236          trace: resolved executable dir: /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core  
  11. 10:29:28.936585 git.c:418               trace: built-in: git fetch-pack --stateless-rpc --stdin --lock-pack --include-tag --thin --depth=2147483647 https://mirrors.ustc.edu.cn/homebrew-core.git/  
  12. error: RPC failed; HTTP 504 curl 22 The requested URL returned error: 504 Gateway Time-out  
  13. fatal: the remote end hung up unexpectedly  
这个。。--depth=2147483647,居然这么深?
查到了网上的方案,参考在这里:记录: homebrew-core is a shallow clone - 腾讯云开发者社区-腾讯云 (tencent.com),我按上面的操作,删除了homebrew-core,homebrew-cask,再进行upgrade,果然 正常了。
 
---
在非正常之前,做了不少操作,比如用官方的uninstall脚本清除了系统,然而也没有什么用。所幸,现在正常了。