I'm using ng2-tel-input in my angular App, so far it was working perfectly but suddenly I started getting an error
node_modules/@types/intl-tel-input/index.d.ts(111,30): error TS2304: Cannot find name 'JQueryDeferred'.
My ng2-tel-input
tag is
<input type="text" ng2TelInput [ng2TelInputOptions]="mobilePhoneInputOptions"
(ng2TelOutput)="getNumber($event)"
(intlTelInputObject)="telInputObject($event)"
(hasError)="hasError($event)"
[(ngModel)]="selectedDriver.attributes.mobile_phone"
(countryChange)="onCountryChange($event)" />
Where default mobilePhoneInputOptions
is
public mobilePhoneInputOptions: any = {
initialCountry: 'us',
separateDialCode: true
};
then it changes according to data.
My package.json
is
{
"name": "ProjectName",
"version": "1.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"@angular-devkit/core": "^7.1.0",
"@angular/animations": "7.1.0",
"@angular/cdk": "^7.1.0",
"@angular/common": "7.1.0",
"@angular/compiler": "7.1.0",
"@angular/compiler-cli": "7.1.0",
"@angular/core": "^7.1.0",
"@angular/flex-layout": "^7.0.0-beta.19",
"@angular/forms": "7.1.0",
"@angular/http": "7.1.0",
"@angular/material": "7.1.0",
"@angular/platform-browser": "7.1.0",
"@angular/platform-browser-dynamic": "7.1.0",
"@angular/router": "7.1.0",
"@angular/upgrade": "7.1.0",
"@fortawesome/angular-fontawesome": "^0.3.0",
"@fortawesome/fontawesome-svg-core": "^1.2.9",
"@fortawesome/free-solid-svg-icons": "^5.6.0",
"@swimlane/ngx-datatable": "^14.0.0",
"@types/chart.js": "^2.7.40",
"@types/intl-tel-input": "^14.0.0",
"angular-bootstrap-md": "^6.3.0",
"angular-file": "^0.5.8",
"angular2-cookie": "^1.2.6",
"angular2-notifications": "^1.0.4",
"angular2-uuid": "^1.1.1",
"angular5-csv": "^0.2.10",
"angulartics2": "^2.4.0",
"aws-api-gateway-client": "^0.2.16",
"aws-sdk": "^2.386.0",
"axios": "^0.16.2",
"axios-retry": "^2.0.1",
"buffer": "^5.2.1",
"chart.js": "^2.5.0",
"core-js": "^2.4.1",
"crypto-js": "^3.1.9-1",
"font-awesome": "^4.7.0",
"hammerjs": "^2.0.8",
"hot-formula-parser": "^2.0.3",
"intl-tel-input": "^14.0.7",
"jquery": "^3.3.1",
"mdbootstrap": "^4.5.15",
"moment": "^2.18.1",
"ng2-mqtt": "^0.1.2",
"ng2-tel-input": "^1.0.15",
"ngx-pagination": "^3.2.1",
"rxjs": "^6.3.3",
"rxjs-compat": "^6.0.0-rc.0",
"ts-helpers": "1.1.2",
"ts-md5": "^1.2.0",
"tslib": "^1.9.0",
"url-template": "^2.0.8",
"uuid": "^3.3.2",
"webdriver-manager": "^12.0.5",
"zone.js": "^0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.11.0",
"@angular/cli": "^7.1.0",
"@angular/compiler-cli": "7.1.0",
"@angular/language-service": "7.1.0",
"@angular/platform-browser": "7.1.0",
"@angular/platform-browser-dynamic": "7.1.0",
"@angular/platform-server": "7.1.0",
"@types/hammerjs": "^2.0.33",
"@types/jasmine": "~2.8.3",
"@types/jasminewd2": "~2.0.2",
"@types/node": "^7.0.32",
"aws-sdk-typescript": "0.0.3",
"codelyzer": "^4.0.1",
"css-loader": "^0.28.0",
"extract-text-webpack-plugin": "^2.1.2",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"node-sass": "^4.10.0",
"protractor": "^5.4.1",
"raw-loader": "^0.5.1",
"rebuild-node-sass": "^1.1.0",
"sass-loader": "^6.0.6",
"ts-node": "^3.1.0",
"tslint": "^5.11.0",
"typescript": "3.1.6",
"webdriver-manager": "^12.0.0"
}
}
and my angular.json
is
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"project-name": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.json",
"assets": [
"src/assets",
"src/favicon.ico"
],
"styles": [
"src/assets/css/pure.css",
"src/assets/css/flexbox.css",
"src/assets/css/style.css",
"src/assets/css/modal.css",
"node_modules/intl-tel-input/build/css/intlTelInput.css",
"src/styles.scss"
],
"scripts": [
"node_modules/aws-sdk/dist/aws-sdk.js",
"node_modules/hot-formula-parser/dist/formula-parser.min.js",
"src/lib/google-tag-manager/stage.js",
"node_modules/chart.js/dist/Chart.js",
"node_modules/hammerjs/hammer.min.js"
]
},
"configurations": {
"dev": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.dev.ts"
}
]
},
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
},
"stage": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.stage.ts"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "project-name:build"
},
"configurations": {
"dev": {
"browserTarget": "project-name:build:dev"
},
"production": {
"browserTarget": "project-name:build:production"
},
"stage": {
"browserTarget": "project-name:build:stage"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "project-name:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"scripts": [
"node_modules/aws-sdk/dist/aws-sdk.js",
"node_modules/hot-formula-parser/dist/formula-parser.min.js",
"src/lib/google-tag-manager/stage.js",
"node_modules/chart.js/dist/Chart.js",
"node_modules/hammerjs/hammer.min.js"
],
"styles": [
"src/material2-app-theme.scss",
"node_modules/font-awesome/scss/font-awesome.scss",
"node_modules/angular-bootstrap-md/scss/bootstrap/bootstrap.scss",
"node_modules/angular-bootstrap-md/scss/mdb-free.scss",
"node_modules/intl-tel-input/build/css/intlTelInput.css",
"src/styles.scss"
],
"assets": [
"src/assets",
"src/favicon.ico"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [],
"exclude": []
}
}
}
},
"project-name-e2e": {
"root": "e2e",
"sourceRoot": "e2e",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "project-name:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [],
"exclude": []
}
}
}
}
},
"defaultProject": "project-name",
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
"styleext": "scss"
},
"@schematics/angular:directive": {
"prefix": "app"
}
}
}
I am using this package one other place where it is running perfectly. So far I've tried
npm install intl-tel-input
npm install @types/intl-tel-input
npm install ng2-tel-input
npm install jquery
npm install @types/jquery
I have also tried deleting the node_modules
folder then running npm i
.
I have also commented the two tags where i was using the package but I am still getting the same errors. I there something I should try? I couldn't find anything related to JQueryDeferred
.
I have solved this problem by deleting the repo from local and again did checkout it from Bitbucket, ran npm i
and problem disappeared. This is strange because I multiple time pulled code from the repo and deleted then reinstalled node modules. I am accepting my answer for now. I don't understand what caused the problem and what I did is not a proper solution so if in case someone can explain or provide a solution I would choose that as the answer.