找不到“$”的类型定义文件
Cannot find type definition file for '$'
我最近尝试将我的 Angular 4 项目升级到 angular 5 以便能够使用 @angular/material 数据表功能,但是在升级所有 angular 对版本 5 的依赖。
我收到错误:"ERROR in error TS2688: Cannot find type definition file for '$'"
我正在使用 angular-cli,这是我的 package.json
{
"name": "app-web-ui",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@amcharts/amcharts3-angular": "^1.5.0",
"@angular/animations": "^5.0.0",
"@angular/cdk": "^5.2.0",
"@angular/cli": "^1.5.0",
"@angular/common": "5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/compiler-cli": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/flex-layout": "^2.0.0-beta.8",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/material": "^5.0.0-rc0",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/router": "^5.0.0",
"@ngui/datetime-picker": "^0.16.2",
"@swimlane/ngx-datatable": "^11.1.7",
"@types/angular": "^1.6.14",
"@types/hammerjs": "^2.0.34",
"@types/signalr": "^2.2.33",
"angular2-draggable": "^1.0.2",
"angular2-font-awesome": "^1.3.0",
"angular2-fontawesome": "^5.2.1",
"angular2-moment": "^1.8.0",
"codelyzer": "^2.1.1",
"core-js": "^2.4.1",
"font-awesome": "^4.7.0",
"hammerjs": "^2.0.8",
"jasmine-spec-reporter": "^3.3.0",
"karma": "^1.6.0",
"moment": "^2.20.1",
"ms-signalr-client": "^2.2.5",
"ngresizable": "^1.0.0",
"ngx-pagination": "^3.0.0",
"rxjs": "^5.5.2",
"s": "^0.1.1",
"ts-node": "^2.1.2",
"webpack": "^3.10.0",
"webpack-sources": "^1.1.0",
"zone.js": "^0.8.5"
},
"devDependencies": {
"@types/jasmine": "^2.5.47",
"@types/node": "^6.0.70",
"codelyzer": "^2.0.1",
"jasmine-core": "^2.5.2",
"jasmine-spec-reporter": "^3.2.0",
"karma": "^1.4.1",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-coverage-istanbul-reporter": "^0.2.3",
"karma-jasmine": "^1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "^5.1.1",
"ts-node": "^2.0.0",
"tslint": "^4.5.1",
"typescript": "2.4.2"
}
}
构建时出错:
有没有人经历过类似的问题并找到了解决方案?
找到问题了。在我的 tsconfig.app.json 文件中,我在 compilerOptions 的类型数组中包含一个“$”。我不确定它是如何到达那里的,但删除它可以解决问题。
我基本上改变了 src/tsconfig.app.json 文件从
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "es2015",
"baseUrl": "",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"types": ["JQuery", "$"]
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}
至
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "es2015",
"baseUrl": "",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"types": ["JQuery"]
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}
我最近尝试将我的 Angular 4 项目升级到 angular 5 以便能够使用 @angular/material 数据表功能,但是在升级所有 angular 对版本 5 的依赖。
我收到错误:"ERROR in error TS2688: Cannot find type definition file for '$'"
我正在使用 angular-cli,这是我的 package.json
{
"name": "app-web-ui",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@amcharts/amcharts3-angular": "^1.5.0",
"@angular/animations": "^5.0.0",
"@angular/cdk": "^5.2.0",
"@angular/cli": "^1.5.0",
"@angular/common": "5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/compiler-cli": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/flex-layout": "^2.0.0-beta.8",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/material": "^5.0.0-rc0",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/router": "^5.0.0",
"@ngui/datetime-picker": "^0.16.2",
"@swimlane/ngx-datatable": "^11.1.7",
"@types/angular": "^1.6.14",
"@types/hammerjs": "^2.0.34",
"@types/signalr": "^2.2.33",
"angular2-draggable": "^1.0.2",
"angular2-font-awesome": "^1.3.0",
"angular2-fontawesome": "^5.2.1",
"angular2-moment": "^1.8.0",
"codelyzer": "^2.1.1",
"core-js": "^2.4.1",
"font-awesome": "^4.7.0",
"hammerjs": "^2.0.8",
"jasmine-spec-reporter": "^3.3.0",
"karma": "^1.6.0",
"moment": "^2.20.1",
"ms-signalr-client": "^2.2.5",
"ngresizable": "^1.0.0",
"ngx-pagination": "^3.0.0",
"rxjs": "^5.5.2",
"s": "^0.1.1",
"ts-node": "^2.1.2",
"webpack": "^3.10.0",
"webpack-sources": "^1.1.0",
"zone.js": "^0.8.5"
},
"devDependencies": {
"@types/jasmine": "^2.5.47",
"@types/node": "^6.0.70",
"codelyzer": "^2.0.1",
"jasmine-core": "^2.5.2",
"jasmine-spec-reporter": "^3.2.0",
"karma": "^1.4.1",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-coverage-istanbul-reporter": "^0.2.3",
"karma-jasmine": "^1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "^5.1.1",
"ts-node": "^2.0.0",
"tslint": "^4.5.1",
"typescript": "2.4.2"
}
}
构建时出错:
有没有人经历过类似的问题并找到了解决方案?
找到问题了。在我的 tsconfig.app.json 文件中,我在 compilerOptions 的类型数组中包含一个“$”。我不确定它是如何到达那里的,但删除它可以解决问题。
我基本上改变了 src/tsconfig.app.json 文件从
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "es2015",
"baseUrl": "",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"types": ["JQuery", "$"]
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}
至
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "es2015",
"baseUrl": "",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"types": ["JQuery"]
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}