gpt4 book ai didi

Angular 8 部署到 Github Pages 失败 -

转载 作者:行者123 更新时间:2023-12-04 10:55:11 25 4
gpt4 key购买 nike

在我的本地主机上一切正常。

然后我用了 ng deploy --base-href=/dentist-angular/将我的应用程序部署到 Github Pages。

我的文本所在的每个部分都有一个 HTTP 错误响应。您应该知道使用 NGX 翻译将所有文本拉入页面 - 所以我认为这是问题的一部分。

我已经删除并重新部署,但问题仍然存在。

控制台中的错误消息...

Object { headers: {…}, status: 404, statusText: "Not Found", url: "https://jamesross06000.github.io/assets/i18n/fr.json", ok: false, name: "HttpErrorResponse", message: "Http failure response for https://jamesross06000.github.io/assets/i18n/fr.json: 

这很可能是路径问题,但是当我完全按照安装和部署说明进行操作时,我不确定从这里开始尝试什么。

HTML...
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Dentist</title>
<base href="https://jamesRoss06000.github.io/dentist-angular/"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<script src="env.js"></script>
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="styles.748d964c6c80975e08dc.css"></head>
<body>
<app-root></app-root>
<script src="runtime-es2015.edb2fcf2778e7bf1d426.js" type="module"></script><script src="runtime-es5.edb2fcf2778e7bf1d426.js" nomodule defer></script><script src="polyfills-es5.6696c533341b95a3d617.js" nomodule defer></script><script src="polyfills-es2015.2987770fde9daa1d8a2e.js" type="module"></script><script src="main-es2015.c08ed25e5c5c9aef5a4b.js" type="module"></script><script src="main-es5.c08ed25e5c5c9aef5a4b.js" nomodule defer></script></body>
</html>

只是在 Github Pages 中使用 NGX 翻译是一个很大的禁忌吗?

如果您需要查看控制台中记录的错误,这里是 Github Pages URL。

这是在控制台日志中重复多次的错误...
ee  @   main-es2015.c08ed25….js:1

这是创建的 dist 文件夹中的文件结构...

enter image description here

谢谢你的帮助。

最佳答案

我找到了一个解决方案,尽管我没有解释为什么它以前不起作用。

要构建 Angular 8 项目并将其部署到 Github 页面,请使用以下...
npm install -g angular-cli-ghpagesng build --prod --base-href "<repo-name>"ngh --dir dist/<project-name>
以上为我做了诀窍。

关于Angular 8 部署到 Github Pages 失败 -,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59251576/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com