我已经将我的应用程序从angular 4升级到angular 6。我得到以下错误。我已经在tsConfig中添加了包含文件。我在运行ng测试时遇到错误。我想知道,当@wtw文件夹包含在tsConfig中时,它为什么会抱怨@wtw文件夹下的文件
"include": [
"./src/**/*",
"./node_modules/@wtw/**/*",
"./node_modules/@types/**/*"
]错误消息
ERROR in ./node_modules/@wtw/platform/services/index.ts
Module build failed (from ../node_modules/@ngtools/webpack/src/index.js):
Error: C:\vstsprojects\testproject\testproject.ClientSide\node_modules\@wtw\platform\services\index.ts is missing from the TypeScript compilation. Please
make sure it is in your tsconfig via the 'files' or 'include' property.
The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an
issue in the library repository to alert its author and ask them to package the library using the Angular Package Format .
at AngularCompilerPlugin.getCompiledFile (C:\vstsprojects\testproject\testproject.ClientSide\node_modules\@ngtools\webpack\src\packages\ngtools\webpac
k\src\angular_compiler_plugin.ts:988:15)
at plugin.done.then (C:\vstsprojects\testproject\testproject.ClientSide\node_modules\@ngtools\webpack\src\packages\ngtools\webpack\src\loader.ts:49:29
)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
@ ./src/app/effects/risk-portfolio/risk-portfolio.effect.spec.ts 5:17-50
@ ./src sync \.spec\.ts$
@ ./src/test.tstsConfig
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"baseUrl": "src",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types",
"type-definition"
],
"lib": [
"es2017",
"dom"
]
},
"include": [
"./src/**/*",
"./node_modules/@wtw/**/*",
"./node_modules/@types/**/*"
]
}发布于 2019-01-08 22:43:27
我得到了同样的错误,在您的app.routing.ts文件中,检查惰性模块的路由路径,检查您的组件名称,并准确地更正路径中的小写或大写。
发布于 2018-09-24 22:22:42
只需尝试创建一个angular 6项目并交叉验证您的文件。只需交叉检查以下文件,看看是否有帮助
在tsconfig.json文件中
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "es2015",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
}在tsconfig.spec.json中
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"types": [
"jasmine",
"node"
]
},
"files": [
"test.ts",
"polyfills.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}在tsconfig.app.json中
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"types": []
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}发布于 2020-07-13 19:28:34
当文件大小写不匹配时,通常会发生这种情况。举个例子,我有一个名为layout的文件夹,里面有layout-dashboard.ts。在我的导入路径中有以下路径,这导致了一个错误。正确的路径是这个,import { DashboardLayoutComponent } from '../layout/dashboard-layout/dashboard-layout.component';,你需要注意的是,第一个没有给出任何与路径相关的错误。我可以说的是,angular文件夹区分大小写。布局!=布局
https://stackoverflow.com/questions/52446988
复制相似问题