我已经安装了npm软件包nemex-angular2-realtimegeolocation来访问地理位置。但是,我遇到一个错误-
./node_modules/nemex-angular2-realtimegeolocation/index.ts
Module build failed: Error: /home/dell/Downloads/Angular-6-Templates/5th March-2019/node_modules/nemex-angular2-realtimegeolocation/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.
我试图将tsconfig.spec.json和tsconfig.app.json中的文件包含在各种来源中,但无济于事。
已完成的更改:
[1] tsconfig.spec.json
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"baseUrl": "./",
"module": "commonjs",
"types": [
"jasmine",
"node"
]
},
"files": [
"test.ts",
"polyfills.ts",
"index.ts",
"../node_modules/nemex-angular2-realtimegeolocation/index.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts",
"**/*.index.ts",
"../src/**/*",
"../node_modules/nemex-angular2-realtimegeolocation/index.ts"
]
}
[2]
tsconfig.app.json
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"baseUrl": "./",
"module": "es2015",
"types": [],
"paths": {
"@angular/*": [
"../node_modules/@angular/*"
]
}
},
"exclude": [
"test.ts",
"**/*.spec.ts",
"../node_modules/nemex-angular2-realtimegeolocation/**/*.spect.ts"
]
}
[3]我什至从nemex-angular2-realtimegeolocation中删除了index.ts文件,但是它给index.ts“找不到文件”错误。