简体   繁体   English

Angular 13.2。 错误:仅将入口点添加到 tsconfig 中的“文件”或“包含”属性

[英]Angular 13.2. error: Add only entry points to the 'files' or 'include' properties in your tsconfig

I've an issue that as per subjected above.我有一个问题,如上所述。

Yesterday wasn't show any problem when calling ng serve on my project.昨天在我的项目上调用 ng serve 时没有显示任何问题。 But today it's shows the error.但是今天它显示了错误。

I'm trying to resolve and find out on google/stackoverflow still unlucky even follow the solutions on every pages suggested such as must edit on tsconfig.app.json include exclude part.我正在尝试解决并在 google/stackoverflow 上发现仍然不幸,即使按照建议的每个页面上的解决方案进行操作,例如必须在 tsconfig.app.json 上进行编辑,包括排除部分。

Until clean install all of nodejs, npm, angular-cli including removing the directory installer even using the latest angular 14.2.直到全新安装所有 nodejs、npm、angular-cli,包括删除目录安装程序,甚至使用最新的 angular 14.2。 but the issue still appear.但问题仍然存在。

Testing with fresh create new project without any component [using standard ng new] (ng new test33) then run (ng serve) still showing the problem.使用没有任何组件的全新创建新项目进行测试 [使用标准 ng new] (ng new test33) 然后运行 (ng serve) 仍然显示问题。

testing environment version:测试环境版本:

windows: 10.0.19044.1766 windows:10.0.19044.1766

nodes: 16.14.0, 16.17.1, 18.10.0节点:16.14.0、16.17.1、18.10.0

npm: ( package from nodes ) npm:(来自节点的 package)

angular-cli: 13.2.0 - 14.2角度-cli:13.2.0 - 14.2

But the issue still appear.但是问题还是出现了。


C:\Users\THG\My Documents\apps\test33>ng serve
√ Browser application bundle generation complete.

Initial Chunk Files   | Names         |  Raw Size
styles.css, styles.js | styles        | 175.24 kB |
polyfills.js          | polyfills     | 174.53 kB |
vendor.js             | vendor        | 173.64 kB |
runtime.js            | runtime       |   6.51 kB |
main.js               | main          |   1.02 kB |

                      | Initial Total | 530.95 kB

Build at: 2022-10-05T04:17:55.815Z - Hash: a99455c1b2851f77 - Time: 23545ms

Warning: C:/Users/THG/My Documents/apps/test33/src/app/app-routing.module.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: C:/Users/THG/My Documents/apps/test33/src/app/app.component.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: C:/Users/THG/My Documents/apps/test33/src/app/app.module.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: C:/Users/THG/My Documents/apps/test33/src/environments/environment.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: C:/Users/THG/My Documents/apps/test33/src/main.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: C:/Users/THG/My Documents/apps/test33/src/polyfills.ts is part of the TypeScript compilation but it's unused.
Add only entry points to the 'files' or 'include' properties in your tsconfig.



../../../Documents/apps/test33/src/main.ts - Error: Module build failed (from ../../../Documents/apps/test33/node_modules/@ngtools/webpack/src/ivy/index.js):
Error: C:\Users\THG\Documents\apps\test33\src\main.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via
 the 'files' or 'include' property.
    at C:\Users\THG\Documents\apps\test33\node_modules\@ngtools\webpack\src\ivy\loader.js:60:26

../../../Documents/apps/test33/src/polyfills.ts - Error: Module build failed (from ../../../Documents/apps/test33/node_modules/@ngtools/webpack/src/ivy/index.js):
Error: C:\Users\THG\Documents\apps\test33\src\polyfills.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at C:\Users\THG\Documents\apps\test33\node_modules\@ngtools\webpack\src\ivy\loader.js:60:26



** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **


× Failed to compile.
- Generating browser application bundles...

Until - Generating browser application bundles... was stuck (looks like hang up) Until - Generating browser application bundles... 被卡住了(看起来像挂断了)

Anyone having solutions or same problem on it?有人有解决方案或同样的问题吗?

What happen with my lappie or nodejs/angular-cli?我的 lappie 或 nodejs/angular-cli 发生了什么?

It's make me stressing out.这让我压力很大。


Refer to @brk queestion:参考@brk问题:

using standard tsConfig files, because it create new from scratch.使用标准的 tsConfig 文件,因为它从头开始创建新的。

tsConfig.json tsConfig.json

/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "forceConsistentCasingInFileNames": true,
    "strict": true,
    "noImplicitOverride": true,
    "noPropertyAccessFromIndexSignature": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es2017",
    "module": "es2020",
    "lib": [
      "es2020",
      "dom"
    ]
  },
  "angularCompilerOptions": {
    "enableI18nLegacyMessageIdFormat": false,
    "strictInjectionParameters": true,
    "strictInputAccessModifiers": true,
    "strictTemplates": true
  }
}

tsConfig.app.json tsConfig.app.json

/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "outDir": "./out-tsc/app",
    "types": []
  },
  "files": [
    "src/main.ts",
    "src/polyfills.ts"
  ],
  "include": [
    "src/**/*.d.ts"
  ]
}

tsConfig.spec.json tsConfig.spec.json

/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "outDir": "./out-tsc/spec",
    "types": [
      "jasmine"
    ]
  },
  "files": [
    "src/test.ts",
    "src/polyfills.ts"
  ],
  "include": [
    "src/**/*.spec.ts",
    "src/**/*.d.ts"
  ]
}

Aargh, I'm not sure with this error. Aargh,我不确定这个错误。

But, I move the directory projects into other directory outside of parent structure of directory and running well.但是,我目录项目移动到目录父结构之外的其他目录并且运行良好。

Weird.. but useful, the other can trying this solution.奇怪..但很有用,其他人可以尝试这个解决方案。

I thought the location C:\Users\ xxx \projects where xxx its become a problem我认为位置 C:\Users\ xxx \projects 其中xxx成为问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从版本 9 更新到 10 后的 Angular 警告堆栈。 ngtypecheck.ts 和 Add only entry points ... in tsconfig - Angular warning stack after the update from version 9 to 10. ngtypecheck.ts and Add only entry points … in tsconfig TypeScript 编译中缺少 home.component.spec.ts 错误。 请通过“文件”或“包含”属性确保它在您的 tsconfig 中 - Error home.component.spec.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property 将 `jquery` 添加到 tsconfig 中的类型字段 - add `jquery` to the types field in your tsconfig 将tsconfig.json属性添加到Gulp任务 - Add tsconfig.json properties to Gulp task tsconfig中的include和Webpack中的entry字段有什么区别? - What are the differences between `include` in tsconfig and `entry` field in webpack? 启动 Angular 11 项目时出现 tsconfig 错误 - tsconfig error when start Angular 11 project tsconfig 包含相对路径 - Tsconfig include relative path 为什么 Tsconfig 需要编译 Javascript 文件 Angular - Why Does Tsconfig Need To Compile Javascript Files Angular Angular 5包含javascript文件 - Angular 5 include javascript files 角度路由错误:应该只包含此文件一次 - Angular routing error: should only include this file once
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM