问题描述
我想构建可在local.client.appname.com:8000/admin/angular获得的我的角度应用程序。该应用程序是用清晰的HTML和CSS编写的,但是按照这个特定的路线,我想构建有角度的应用程序。 当我使用:
ng build
然后我在这条路线上的应用程序找不到styles.css
我使用时遇到同样的问题:
ng build
ng build --base-href=local.client.appname.com:8000/admin/angular
ng build --base-href=/admin/angular
有什么办法吗?
编辑:
它是我的index.html文件
<!doctype html>
<html lang="en">
<head>
<Meta charset="utf-8">
<title>Admin</title>
<base href="/admin/angular/">
<Meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="styles.369fecace4557219e275.css"></head>
<body class="sidebar-mini layout-fixed layout-navbar-fixed text-sm">
<script src="runtime-es2015.858f8dd898b75fe86926.js" type="module"></script><script src="polyfills-es2015.fc22aee4fbf951b1085c.js" type="module"></script><script src="runtime-es5.741402d1d47331ce975c.js" nomodule></script><script src="polyfills-es5.e47f6f613cd9d8ed0bdf.js" nomodule></script><script src="scripts.2627377240feaa5a6485.js"></script><script src="main-es2015.890c3f6df5b6a90a7c80.js" type="module"></script><script src="main-es5.9afafd3aaac89877d412.js" nomodule></script></body>
</html>
我的错误是:
http://local.client.appname.com:8000/dist/angular/dist/admin/styles.css?05770201d1c76b92c136947b9f2ea1f8 net::ERR_ABORTED 404 (Not Found)
解决方法
ng build --base-href = / admin / angular /
,并确保dist的内容在实际的文件夹/ admin / angular中 应该有index.html文件和项目的其余部分。