Geo*_*rds 5 angular-cli angular
我有一个工作的ng cli项目,它是用cli 的beta.21版本创建的.我想更新它以使用cli项目的最新结构,因此使用cli(v.1.0.0)创建了一个新项目.然后,我基本上将现有项目应用程序文件的内容放入新项目中并从那里开始.
奇怪的是,我的新项目构建没有问题,并产生我期待的大小和块.如果我运行基于快速的后端,它提供./dist目录的内容,那么我的应用程序按预期工作.但是,如果我运行,ng serve我会Cannot GET /在浏览器中收到错误.
我真的不确定是什么导致这个(我最大的怀疑是我的项目有文件结构client/src/app而不是标准,src/app但是我已经改变了所有对文件路径的引用我可以找到并且随着构建工作,我假设那很好)?
关于如何进一步调试的任何想法/建议?
client/src/index.html:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>DemoProj</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root>Loading...</app-root>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
.angular-cli.json:
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "coty-monitoring-system"
},
"apps": [
{
"root": "client/src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.css"
],
"scripts": [
"../../node_modules/chart.js/dist/Chart.bundle.js",
"../../node_modules/hammerjs/hammer.min.js"
],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "client/src/tsconfig.app.json"
},
{
"project": "client/src/tsconfig.spec.json"
},
{
"project": "e2e/tsconfig.e2e.json"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"component": {}
}
}
Run Code Online (Sandbox Code Playgroud)
失败请求的浏览器网络选项卡:
以下是cli返回的页面源:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /</pre>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
看起来很好.可能你没有ng serve在项目的文件夹上运行
.
使用CLI时,您必须运行ng serveapp.module.ts所在的位置**通常:
$ projectFolder\src\app
| 归档时间: |
|
| 查看次数: |
2588 次 |
| 最近记录: |