Continuous integration Gitlab pages CI/CD管道正在通过,但生成的页面不';不加载资源

Continuous integration Gitlab pages CI/CD管道正在通过,但生成的页面不';不加载资源,continuous-integration,gitlab,gitlab-ci,Continuous Integration,Gitlab,Gitlab Ci,以下是.gitlab ci.yml文件: pages: stage: deploy script: - apt-get update - apt-get install -y nodejs npm # install NPM in order to build the website - npm install - npm run build # build the website - mv dist public

以下是
.gitlab ci.yml
文件:

pages:
  stage: deploy
  script:
  - apt-get update
  - apt-get install -y nodejs npm  # install NPM in order to build the website
  - npm install
  - npm run build                  # build the website
  - mv dist public                 # move the built website to the public directory
  artifacts:
    paths:
    - public
  only:
  - master
管道传递,即作业
页面
页面:部署
正在传递。此外,网站的构建也是正确的:当我下载工件时,所有资源都显示在
public
目录中

但是,当我查看时,index.html正在加载,但所有的资源都没有加载(404代码)


这里是回复:

GitLab的页面只支持静态网页,而不支持动态网页。这意味着您不能运行像
node.js
这样的服务器,而只能生成HTML和其他静态文件

您可以在此处阅读更多信息:


我没有运行Node.js服务器。我使用Node.js生成静态页面(它工作得很好:当我下载工件时,一切都在这里)。然后我将生成的页面移动到
public
目录中,然后让Gitlab处理其余的部分。啊,我明白了。这就是我试图快速回答问题的原因!我试着从链接的存储库下载工件,它看起来与GitLab上的方式完全相同。如果您读取生成的
index.html
,则会出现类似
加载…
这样的行,并出现错误:
。如果您通读了gitlab pages作业,npm会发出一些警告。当您生成页面时,某些内容似乎没有按您希望的方式工作。好的,我的问题。我刚刚发现问题的根源是URL以
/
开头,但Gitlab页面不是托管在根目录上的。仅仅一个基本错误就浪费了这么多时间。。。尽管如此,还是要感谢你的帮助。几乎总是最基本的错误让我们失望!很高兴听到你终于明白了,而且总是很乐意帮忙。