Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Json Angular项目在更新后未运行_Json_Angular_Typescript - Fatal编程技术网

Json Angular项目在更新后未运行

Json Angular项目在更新后未运行,json,angular,typescript,Json,Angular,Typescript,我是angular的新手,我正在尝试在angular 6升级到8之后构建我的项目,但是出于某种原因,我收到了两条我不理解的警告,我在互联网上搜索过,但没有一个解决方案有效,感谢您的帮助 WARNING in D:/Spark/doPayroll Backup/dopayroll-front-end/src/app/banks/addbank.model.ts is part of the TypeScript compilation but it's unused. Add only entr

我是angular的新手,我正在尝试在angular 6升级到8之后构建我的项目,但是出于某种原因,我收到了两条我不理解的警告,我在互联网上搜索过,但没有一个解决方案有效,感谢您的帮助

WARNING in D:/Spark/doPayroll Backup/dopayroll-front-end/src/app/banks/addbank.model.ts is part of 
the TypeScript compilation but it's unused.
Add only entry points to the 'files' or 'include' properties in your tsconfig.

WARNING in D:/Spark/doPayroll Backup/dopayroll-front-end/src/environments/environment.prod.ts is 
part of the TypeScript compilation but it's unused.
Add only entry points to the 'files' or 'include' properties in your tsconfig.
tsconfig.app.json

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
  "outDir": "../out-tsc/app",
  "types": []
},
"exclude": [
  "test.ts",
  "**/*.spec.ts"
  ]
}
tsconfig.spec.json

{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"types": [
  "jasmine",
  "node"
]
},
"files": [
  "test.ts",
  "polyfills.ts",
  ],
"include": [
  "**/*.spec.ts",
  ]
}

请检查您以前使用过的angular版本,并尝试使用特定的版本安装命令安装相同的版本

使用以下命令:

将6.1.1替换为特定版本

npm install -g @angular/cli@6.1.1

尝试将此添加到您的tsconfig.app.json:

检查tsconfig的这一点。environment.prod.ts是typescript编译的一部分,但未使用

tsconfig.app.json

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
  "outDir": "../out-tsc/app",
  "types": []
},
"exclude": [
  "test.ts",
  "**/*.spec.ts"
  ]
}

要解决警告,请执行以下操作:

"environment.prod.ts" is part of the TypeScript compilation but it's unused.
Add only entry points to the 'files' or 'include' properties in your tsconfig.
在您的组件中:

import { environment } from 'src/environments/environment';
...
getProjects() {
// observable
if(!environment.production) {
    console.log(environment.apiUrl);
}
this.callback$ = this.apiService.get(environment.apiUrl);
在您的环境中

export const environment = {
  production: false,
  apiUrl: 'https://abc.execute-api.us-west-2.amazonaws.com/prod/projects'
};
在您的环境中。prod.ts

export const environment = {
  production: true,
  apiUrl: 'https://abc.execute-api.us-west-2.amazonaws.com/prod/projects'
};

我仍然收到同样的警告尝试禁用Ivy,因为它在版本8中默认启用查看更新的代码。实际上,我添加了这段代码,但仍然得到相同的警告,还有其他想法吗?尝试添加.ts src/***.tsHello,谢谢你的回答。你能解释一下原始配置有什么问题吗?为什么你的配置能解决这个问题?这可以帮助处于同样情况的人
export const environment = {
  production: true,
  apiUrl: 'https://abc.execute-api.us-west-2.amazonaws.com/prod/projects'
};