正在升级 Angular 获取索引中脚本的 404 未找到
Upgrading Angular getting 404 Not Found for scripts in Index
我刚刚将我的项目从 Angular 2.4.7 和 Angular CLI 1.0.0 升级到 Angular 4.0.0 和 Angular CLI 1.0.0 -beta.31。自升级以来,我收到以下错误:
font-awesome.min.css Failed to load resource: the server responded with a status of 404 (Not Found)
material-icons.css Failed to load resource: the server responded with a status of 404 (Not Found)
global-styles.css Failed to load resource: the server responded with a status of 404 (Not Found)
hammer.js Failed to load resource: the server responded with a status of 404 (Not Found)
这些与下面我 index.html 中的脚本引用有关。自升级以来我没有改变结构,有人知道我为什么会收到这些错误吗?
Index.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Tellurium Platform</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="./app/library/css/font-awesome.min.css">
<link rel="stylesheet" href="./global-styles.css">
<link rel="stylesheet" href="./app/library/css/material-icons.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">
<!--For Material 2 slider elements-->
<script src="./app/library/js/hammer.js"></script>
</head>
<body class="canvas">
<app-root>Loading...</app-root>
</body>
</html>
看看这个官方release notes文件夹结构改变了,你应该把路径改成
<link rel="stylesheet" href="./src/app/library/css/font-awesome.min.css">
<link rel="stylesheet" href="./global-styles.css">
<link rel="stylesheet" href="./src/app/library/css/material-icons.css">
将您的依赖项移动到 .angular-cli.json
文件中,这样的脚本下
"scripts": [
....,
"./app/library/js/hammer.js"
],
from the latest angulae cli you have to add all external files(css and js) under the script and style tag in the angular-cli.json file
我刚刚将我的项目从 Angular 2.4.7 和 Angular CLI 1.0.0 升级到 Angular 4.0.0 和 Angular CLI 1.0.0 -beta.31。自升级以来,我收到以下错误:
font-awesome.min.css Failed to load resource: the server responded with a status of 404 (Not Found)
material-icons.css Failed to load resource: the server responded with a status of 404 (Not Found)
global-styles.css Failed to load resource: the server responded with a status of 404 (Not Found)
hammer.js Failed to load resource: the server responded with a status of 404 (Not Found)
这些与下面我 index.html 中的脚本引用有关。自升级以来我没有改变结构,有人知道我为什么会收到这些错误吗?
Index.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Tellurium Platform</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="./app/library/css/font-awesome.min.css">
<link rel="stylesheet" href="./global-styles.css">
<link rel="stylesheet" href="./app/library/css/material-icons.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">
<!--For Material 2 slider elements-->
<script src="./app/library/js/hammer.js"></script>
</head>
<body class="canvas">
<app-root>Loading...</app-root>
</body>
</html>
看看这个官方release notes文件夹结构改变了,你应该把路径改成
<link rel="stylesheet" href="./src/app/library/css/font-awesome.min.css">
<link rel="stylesheet" href="./global-styles.css">
<link rel="stylesheet" href="./src/app/library/css/material-icons.css">
将您的依赖项移动到 .angular-cli.json
文件中,这样的脚本下
"scripts": [
....,
"./app/library/js/hammer.js"
],
from the latest angulae cli you have to add all external files(css and js) under the script and style tag in the angular-cli.json file