隐秘的版本问题————

Dockerfile中 RUN yum -y install vim失败Cannot prepare internal mirrorlist: No URLs in mirrorlist

目录:

  • 写在前面:心得+本文精华(本文该问题的思考解决方式)

  • 写在后面:为解决本文该问题----我的折腾

心得+本文精华(本文该问题的思考解决方式)

♡ 心得:修改文件,记得备份!尤其是配置文件

♡ 本文该问题的思考解决方式:实际上就是开发中遇到的版本问题

一、问题

1、系统版本:linux版本centos7.6(1080)

2、错误背景:我想要自定义tomcat环境镜像,通过build Dockerfile的方式

  • Dockerfile 文件内容如下:
FROM centos
MAINTAINER ylb<11> ADD jdk-8u301-linux-aarch64.tar.gz /usr/local/
ADD apache-tomcat-9.0.62.tar.gz /usr/local/ RUN yum -y install vim ENV MYPATH /usr/local/
WORKDIR $MYPATH ENV JAVA_HOME /usr/local/jdk1.8.0_301
ENV CLASSPATH $JAVA_HOME/lib/
ENV CATALINA_HOME /usr/local/apache-tomcat-9.0.62
ENV CATALINA_BASH /usr/local/apache-tomcat-9.0.62
ENV PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin:$CATALINA_HOME/lib EXPOSE 8080 CMD /usr/local/apache-tomcat-9.0.62/bin/startup.sh && tail -F /usr/local/apache-tomcat-9.0.62/logs/catalina.out

3、错误发生:执行到RUN yum -y install vim就报错,Cannot prepare internal mirrorlist: No URLs in mirrorlist

4、错误原因:

究其根因是版本问题

  • 学习docker的视频,我跟着狂神的视频,为了减少错误,我选择和他系统保持一致,安装的软件、镜像、容器的版本等等(涉及到版本的)都保持一致
  • 但是,问题在于,狂神的视频发布的时间和现在不同,视频的last版本,是他当时的last
    • 大白话就是,狂神当时(last)最新的centos版本是7.xx,而现在(last)最新的版本的centos是8.xxx

出现版本原因的还有yum

  • 伴随着不同centos版本所兼容的yum,它的内容是不同的
    • 举例:Centos-vault-6.10.repo 和 Centos-vault-8.5.2111.repo的对比:发现版本6的内容比较少,它相对于8的话,没有[centosplus]、[PowerTools]、[AppStream]

    • 最最重要的是:本次问题报错所没有AppStream,而这个AppStream是版本8的centos才有的,是版本8的新增内容,在版本7是没有它的,官网没有提供!

认识到版本的重要性了吧,内容的增删改!

二、正确解决方式

方式1:升级centos系统为版本8的,然后再使用build Dockerfile

方式2:涉及到centos版本的地方,指明版本,如本文问题核心Dockerfile中的 FROM centos:7

  • 指定dockerfile的centos版本

三、为什么我知道"这个AppStream是版本8的centos才有的,是版本8的新增内容,在版本7是没有它的,官网没有提供"

1、线索1:搜索问题"Cannot prepare internal mirrorlist: No URLs in mirrorlist"

发现:

  • 解释了问题原因:

在2022年1月31日,CentOS团队终于从官方镜像中移除CentOS 8的所有包。

CentOS 8已于2021年12月31日寿终正非,但软件包仍在官方镜像上保留了一段时间。现在他们被转移到https://vault.centos.org

2、线索2:

跟着解决方案的文章,发现:

  • 镜像和仓库:阿里、腾讯、中科院

http://mirrors.ustc.edu.cn/help/centos.html

https://mirrors.aliyun.com/repo/

https://mirrors.cloud.tencent.com/repo/

忽然发现,哦,原来7是真的没有appstream

补充:看文章的时候,注意文章涉及到链接的地方,版本、版本、版本!

1)有时候文章提供了解决方法,但是版本和咱对不上,怎么办?

  • 去掉一些参数,自己进入网站挑选合适自己的版本的

2)举例:搜索No URLs in mirrorlist error,找到某一篇文章,他提供了一种解决方案:

3)提取链接到浏览器,把版本对应不上的参数去掉,得到:

https://mirrors.aliyun.com/repo/

3、线索3:搜索问题的时候,就算我输入centos7,特意强调了centos 版本是7

发现:

  • 搜索出来的版本都是8的,这个是一个提示点

为解决本文该问题----我的折腾

  • 结果是无效折腾

1、错误原因:

  • 搜索得知错误原因,看到了centos版本是8,以为是所有的版本都一样,然后,将别人文章centos版本8版本,直接改成7,以为就完美解决问题

在2022年1月31日,CentOS团队终于从官方镜像中移除CentOS 8的所有包。

CentOS 8已于2021年12月31日寿终正非,但软件包仍在官方镜像上保留了一段时间。现在他们被转移到https://vault.centos.org

2、将别人文章centos版本8版本,直接改成7,以为就完美解决问题

1、错误:

CentOS Linux 8 - AppStream                       21  B/s |  38  B     00:01
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
The command '/bin/sh -c yum -y install vim' returned a non-zero code: 1

2、解决手段:

① 如果你仍然需要运行你的旧CentOS 8,你可以在/etc/yum.repos中更新repos.d使用vault.centos.org代替mirror.centos.org。

cd /etc/yum.repos.d
vi CentOS-AppStream.repo
[appstream]
name=CentOS $releasever - AppStream
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/AppStream/$basearch/os/
baseurl=https://vault.centos.org/centos/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

② 执行命令:

yum clean all
yum makecache

2-2、又发生错误:

https://vault.centos.org/centos/7/AppStream/x86_64/os/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found

Determining fastest mirrors
https://vault.centos.org/centos/7/AppStream/x86_64/os/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below wiki article https://wiki.centos.org/yum-errors If above article doesn't help to resolve this issue please use https://bugs.centos.org/. One of the configured repositories failed (CentOS Linux 7 - AppStream),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this: 1. Contact the upstream for the repository and get them to fix the problem. 2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work). 3. Run the command with the repository temporarily disabled
yum --disablerepo=appstream ... 4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage: yum-config-manager --disable appstream
or
subscription-manager repos --disable=appstream 5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise: yum-config-manager --save --setopt=appstream.skip_if_unavailable=true failure: repodata/repomd.xml from appstream: [Errno 256] No more mirrors to try.
https://vault.centos.org/centos/7/AppStream/x86_64/os/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found

2-2、错误原因:

  • 是因为yum已经更新了的原因导致的 http://mirrors.163.com/centos/ 进官网可以看到已经更新到7.x了

    打开CentOS7-Base.repo(名字可能不一样),一般在 ./etc/yum.repos.d文件夹下
vim /etc/yum.repos.d/CentOS7-Base.repo
# 将其中baseurl中的$releasever全改为7

2-2、解决手段:

  • 解决阿里云CentOS7 yum安装appstream报错,更新yum后无法makecache的问题

  • 将/etc/yum.repos.d/CentOS-AppStream.repo,替换为如下:

[appstream]
name=CentOS-$releasever
baseurl=http://mirrors.aliyun.com/centos/$releasever/appstream/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

3、解决无效,尝试其他解决方案:

(1)方式一:测试无效

(2)方式二:测试也无效

1)将源文件备份

cd /etc/yum.repos.d/ && mkdir backup && mv *repo backup/

2)下载阿里源文件

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

3)更新源里面的地址

sed -i -e "s|mirrors.cloud.aliyuncs.com|mirrors.aliyun.com|g " /etc/yum.repos.d/CentOS-*
sed -i -e "s|releasever|releasever-stream|g" /etc/yum.repos.d/CentOS-*

4)生成缓存

yum clean all && yum makecache

3-2、又报错

  • 问题是:执行第四步yum clean all && yum makecache报错:failure: repodata/repomd.xml from AppStream: [Errno 256] No more mirrors to try.
One of the configured repositories failed (CentOS-7-stream - AppStream - mirrors.aliyun.com),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this: 1. Contact the upstream for the repository and get them to fix the problem. 2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work). 3. Run the command with the repository temporarily disabled
yum --disablerepo=AppStream ... 4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage: yum-config-manager --disable AppStream
or
subscription-manager repos --disable=AppStream 5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise: yum-config-manager --save --setopt=AppStream.skip_if_unavailable=true failure: repodata/repomd.xml from AppStream: [Errno 256] No more mirrors to try.
http://mirrors.aliyuncs.com/centos/7-stream/AppStream/x86_64/os/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/7-stream/AppStream/x86_64/os/repodata/repomd.xml: (28, 'Connection timed out after 30000 milliseconds')
https://mirrors.aliyun.com/centos/7-stream/AppStream/x86_64/os/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
http://mirrors.aliyun.com/centos/7-stream/AppStream/x86_64/os/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
http://mirrors.aliyuncs.com/centos/7-stream/AppStream/x86_64/os/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/7-stream/AppStream/x86_64/os/repodata/repomd.xml: (28, 'Connection timed out after 30001 milliseconds')
http://mirrors.aliyuncs.com/centos/7-stream/AppStream/x86_64/os/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/7-stream/AppStream/x86_64/os/repodata/repomd.xml: (28, 'Connection timed out after 30001 milliseconds')
http://mirrors.aliyuncs.com/centos/7-stream/AppStream/x86_64/os/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/7-stream/AppStream/x86_64/os/repodata/repomd.xml: (28, 'Connection timed out after 30000 milliseconds')
http://mirrors.aliyuncs.com/centos/7-stream/AppStream/x86_64/os/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/7-stream/AppStream/x86_64/os/repodata/repomd.xml: (28, 'Connection timed out after 30001 milliseconds')
http://mirrors.aliyuncs.com/centos/7-stream/AppStream/x86_64/os/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/7-stream/AppStream/x86_64/os/repodata/repomd.xml: (28, 'Connection timed out after 30001 milliseconds')
[root@iZwz9535z41cmgcpkm7i81Z yum.repos.d]#

3-2、错误原因是:在于yum源问题

3-2、解决手段:解决yum源问题

1)查看centos系统本身所安装的yum依赖包

rpm -qa|grep yum

2)卸载这些软件包 rpm -e xx --nodeps

  1. 进入centos镜像网站找到自己对应系统需要的yum包
  • 查看系统的命令:
 cat /etc/redhat-release
  • 查看系统的位数:
file /bin/ls
  1. 下载yum依赖包:
  • 网站:https://vault.centos.org/
  • 找到对应版本的os/x86_64/Packages/
  • 分别下载[注意:我的linux版本是centos7.6(1080)]
wget https://vault.centos.org/7.6.1810/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm

wget https://vault.centos.org/7.6.1810/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

wget https://vault.centos.org/7.6.1810/os/x86_64/Packages/yum-3.4.3-1①61.el7.centos.noarch.rpm

5)安装yum依赖包

rpm -ivh yum-*

6)更换CentOS-Base.repo

① 进入 /etc/yum.repos.d,先备份

cd /etc/
cd yum.repos.d
# 备份一下:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

② 进入官网:http://mirrors.ustc.edu.cn/help/centos.html

  • 自己先建立一个txt文件,内容拷贝进去后,修改名称为CentOS-Base.repo
  • 使用工具xftp,将CentOS-Base.repo 传输到/etc/yum.repos.d目录
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
# [base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

③ 执行命令:

yum clean all
yum makecache

还报错,你以为到这里,我就放弃了吗?

---yes, 我的贪吃蛇已经快排名第一了哈哈哈

  • 继续解决~~~

二、继续我的不正确解决手段:

哇塞,玩完贪吃蛇的我,不一样了,眼睛不一样了,一瞅,立马发现了,自己的centos的配置文件下的yum.repos.d/目录下的文件和别人不同

  • 发现缺少文件了

1、再搜索问题,发现缺少文件了

"将/etc/yum.repos.d/目录下的CentOS-Base.repo、CentOS-AppStream.repo、CentOS-Extras.repo中的mirrorlist注释掉,将baseurl 修改为阿里源......"

2、解决方式1【结果悲捶了,只剩下一个Centos-Base.repo文件了-----说明了备份的重要性】:

将/etc/yum.repos.d 清空后,重新下载

# 删除yum.repos.d目录下所有文件
rm -f /etc/yum.repos.d/*
# 然后重新下载阿里的源(确保网络连接)--注意版本哦,我的centos是7的版本
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# 清理缓存
yum clean all

心得:修改文件,记得备份!

● 所以,咱没备份,配置文件全没了,咱重置一下系统吧

重置Linux系统

  • 在阿里云官网上找到你购买的那个服务器,点一下重置系统,选择centos7,然后重置一下密码

1、重置系统过后、发现/etc/yum.repos.d/目录下:

  • CentOS-Base.repo
  • epel.repo

2、重新安装docker、配置阿里云镜像加速

(1)安装

# 1、卸载旧版本:
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
# 2、使用仓库安装
# 需要的安装包
sudo yum install -y yum-utils
# 设置仓库【默认是国外的,我们不要使用国外的,需要使用国内的阿里云镜像地址】
sudo yum-config-manager \
--add-repo \
https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo # 更新yum 软件包索引
yum makecache fast # 3、安装 Docker 引擎 docker-ce 社区 docker-ee 企业版
yum install docker-ce docker-ce-cli containerd.io # 4、启动 Docker
systemctl start docker # 检查是否成功启动
docker version # 5、测试hello-world
docker run hello-world # 查看下载的镜像
docker images

3、阿里云镜像加速

(1)登录阿里云官网,点击控制台,找到产品与服务,搜容器镜像服务

  • 镜像加速器:

(2)配置使用:

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://o10wzpax.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

● 发现/etc/yum.repos.d/目录下:

  • CentOS-Base.repo
  • docker-ce.repo
  • epel.repo
  • epel.repo.rpmnew
  • epel-testing.repo

三、错误依旧

折腾累了,贪吃蛇也玩得手指起泡了,突然这次又火眼金睛,发现了阿里、腾讯镜像中,好奇对比一下centos7—Base.repo 和 centos8—Base.repo,

还有,之前搜索发现:CentOS团队终于从官方镜像中移除CentOS 8的所有包。

CentOS 8已于2021年12月31日寿终正非,但软件包仍在官方镜像上保留了一段时间。现在他们被转移到https://vault.centos.org

顺便对比一下:Centos-vault-6.10.repo 和 Centos-vault-8.5.2111.repo (因为没有版本7的,所以找6的来对比)

  • 恍惚之间,想到了时间是一把杀猪刀,现在是2022年了,而我的学习视频,狂神的Docker最新超详细版教程通俗易懂视频,是2020年的

    • 在下版本,有何贵干!

【在下版本,有何贵干?】Dockerfile中 RUN yum -y install vim失败Cannot prepare internal mirrorlist: No URLs in mirrorlist的更多相关文章

  1. yum -y install php-mysql 版本冲突

    yum -y install  php-mysql 版本冲突 2018年09月02日 19:16:59 乐于技术分享 阅读数:640   [root@itop yum.repos.d]# yum -y ...

  2. Dockerfile 中 RUN, CMD, ENTRYPOINT 的区别

    RUN 指令:用于指定 docker build 过程中要运行的命令. 语法格式: RUN <command> 或 RUN ["<executeable>" ...

  3. docker -v 和Dockerfile 中VOLUME 区别

    在学习Dockerfile的过程中有个VOLUME命令,很多教程或书中说的是用来定义匿名卷的,其作用如下: 容器运行时应该尽量保持容器存储层不发生写操作,对于数据库类需要保存动态数据的应用,其数据库文 ...

  4. CentOS7中rpm,yum软件安装命令

    RPM包常用安装位置说明 /etc/                   配置文件安装目录 /usr/bin/               可执行的命令安装目录 /usr/lib/           ...

  5. 在centos7中使用yum安装mysql数据库并使用navicat连接

    1.安装 1.查看yum列表,发现没有mysql [root@server-mysql src]# yum list mysql 已加载插件:fastestmirror Repodata is ove ...

  6. CentOS7中使用yum安装nginx和php7.2的方法

    c 1.安装源 安装php72w,是需要配置额外的yum源地址的,否则会报错不能找到相关软件包. php高版本的yum源地址,有两部分,其中一部分是epel-release,另外一部分来自webtat ...

  7. Centos 6.5中使用yum安装jdk

    默认会有open-jdk的安装 我们需要卸载 卸载过程: 查找rpm安装包 rpm –aq|grep java; 卸载 rpm –e –nodeps 安装包 查看目前是否通过yum进行安装jdk yu ...

  8. Linux中的yum是什么?如何配置?如何使用?

    yum,是Yellow dog Updater Modified的简称,起初是由yellow dog这一发行版的开发者Terra Soft研发,用python写成,那时还叫做yup(yellow do ...

  9. linux中配置yum文件

    yum简介:yum的宗旨是自动化地升级,安装/移除rpm包,收集rpm包的相关信息,检查依赖性并自动提示用户解决. yum的关键之处是要有可靠的repository,顾名思义,这是软件的仓库,它可以是 ...

随机推荐

  1. 【推理引擎】ONNX 模型解析

    定义模型结构 首先使用 PyTorch 定义一个简单的网络模型: class ConvBnReluBlock(nn.Module): def __init__(self) -> None: su ...

  2. 第九届蓝桥杯 C组 Java 等腰三角形

    目录 题目 解答 题目 题目描述 本题目要求你在控制台输出一个由数字组成的等腰三角形. 具体的步骤是: 1. 先用1,2,3,...的自然数拼一个足够长的串 2. 用这个串填充三角形的三条边.从上方顶 ...

  3. 开启 Spring Boot 特性有哪几种方式?

    1)继承spring-boot-starter-parent项目 2)导入spring-boot-dependencies项目依赖

  4. 什么是 Spring Boot?

    Spring Boot 是 Spring 开源组织下的子项目,是 Spring 组件一站式解决方案,主要是简化了使用 Spring 的难度,简省了繁重的配置,提供了各种启动器,开发者能快速上手.

  5. 关于kafka客户端版本与服务端版本不一致导致的一次坑

    上周开发了一个功能,需要使用kafka接上游数据并入库,本地开发时,自己安装了一个kafka服务,开发测试时使用本地的kafka服务给主题发消息,然后在自己本地的代码中进行调试.使用的kafka版本如 ...

  6. Zookeeper 文件系统 ?

    Zookeeper 提供一个多层级的节点命名空间(节点称为 znode).与文件系统不 同的是,这些节点都可以设置关联的数据,而文件系统中只有文件节点可以存放 数据而目录节点不行. Zookeeper ...

  7. c语言思维导图

  8. poj_3253_priority queue

    描述 农夫约翰想要修篱墙,他需要N块木板,第i块板长Li.然后他买了一块很长的板子,足够他分成N块.忽略每次锯板子带来的损失. 约翰忘记买锯子了,于是像Don借.Don要收费,每次锯一下,就要收一次板 ...

  9. 实现自定义的小程序底部tabbar

    背景 诶,当然是为了实现更有温度的代码啦(背后设计师拿着刀对着我) 自带tabbar app.json中配置: tabBar: { backgroundColor: '#fff', borderSty ...

  10. H5的audio在ios系统的微信上不能自动播放的问题

    前几天有个需求,要在H5页面中添加背景音乐,本以为很easy,却也踩了一些坑,废话不多说,进入正题: 撸完代码测试的时候才发现在安卓手机上背景音乐可以正常播放,但在iphone里的微信和safari中 ...