I wanted to upgrade the Angular version in my project from 7 to 13, but I am facing some issues. Below you can see my package in Json format:
{
"name": "comresi-angular",
"version": "0.0.0",
"scripts": {
"start": "ng serve",
"start:local": "ng serve --base-href=/",
"build:prod": "ng build --configuration production",
"build:dev": "ng build ----configuration dev",
"build:local": "npm run build:dev && npm run copy_tomcat",
"copy_tomcat": "xcopy \"../webapp/resources\\*\" \"%CATALINA_HOME%\\webapps\\erlcr\\resources\" /s /i /y > nul"
},
"private": true,
"dependencies": {
"#angular/animations": "~13.1.0",
"#angular/cdk": "~13.1.0",
"#angular/common": "~13.1.0",
"#angular/compiler": "~13.1.0",
"#angular/core": "~13.1.0",
"#angular/forms": "~13.1.0",
"#angular/http": "^7.0.0",
"#angular/material": "~13.1.0",
"#angular/platform-browser": "~13.1.0",
"#angular/platform-browser-dynamic": "~13.1.0",
"#angular/service-worker": "~13.1.0",
"#angular/router": "~13.1.0",
"#ngx-translate/core": "11.0.1",
"#ngx-translate/http-loader": "4.0.0",
"#types/bingmaps": "0.0.1",
"#types/jquery": "^3.3.22",
"#types/npm": "^2.0.29",
"#types/slickgrid": "^2.1.26",
"ag-grid-angular": "^19.0.0",
"ag-grid-community": "^19.0.0",
"angular-maps": "^6.0.1",
"angular-slickgrid": "^2.1.8",
"bingmaps": "^2.0.3",
"bootstrap": "^4.1.3",
"core-js": "^2.5.4",
"dhtmlx-gantt": "file:gantt_7.1.8_evaluation",
"font-awesome": "^4.7.0",
"jquery": "^3.3.1",
"jqwidgets-scripts": "^6.1.0",
"moment": "^2.19.1",
"rxjs": "~7.4.0",
"rxjs-compat": "^7.4.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"#angular-devkit/build-angular": "13.1.2",
"#angular/cli": "~13.1.0",
"#angular/compiler-cli": "~13.1.0",
"#angular/language-service": "~13.1.0",
"#types/jasmine": "~2.8.8",
"#types/jasminewd2": "~2.0.3",
"#types/node": "~8.9.4",
"codelyzer": "~4.3.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~4.4.3",
"rxjs": "~7.4.0"
}
}
but I am getting the following error while running npm install:
While resolving: comresi-angular#0.0.0
Found: #angular-devkit/build-angular#0.10.7
node_modules/#angular-devkit/build-angular
dev #angular-devkit/build-angular#"13.1.2" from the root project
Could not resolve dependency:
dev #angular-devkit/build-angular#"13.1.2" from the root project
Conflicting peer dependency: #angular/core#13.1.1
node_modules/#angular/core
peer #angular/core#"13.1.1" from #angular/service-worker#13.1.1
node_modules/#angular/service-worker
#angular/service-worker#"~13.1.0" from the root project
peerOptional #angular/service-worker#"^13.0.0 || ^13.1.0-next" from #angular-devkit/build-angular#13.1.2
node_modules/#angular-devkit/build-angular
dev #angular-devkit/build-angular#"13.1.2" from the root project
Could you help me to understand why I am getting that error?
If you use the official angular update website and you put your angular versions From 7.0 To 13.0 you will get the following warning:
so obviously you need to go through all the major versions until v13.0
As per my experience with project. It is better to build a simple product with latest version (or version which you want). and add a component from your existing application gradually.
Related
I am working to update my app to Angular 9 CLI and all of my NPM packages to the latest versions. But when I try to make a GET call to load the data on page load the page breaks with a 400 error returned from the server. This endpoint call breaks:
#Effect()
getAllData$ = this.action$.pipe(
ofType<DataAction>(DATA_ACTION_TYPES.GET_ALL_DATA),
switchMap(() => {
return this.dataservice.getAllData().pipe(
map(data => {
const payload = new DataPayload();
payload.data = data;
return new GottenAllDataAction(data);
})
);
})
);
public getAllData(): Observable<any[]> {
// code hits the dataEndpoint
return this.httpClient
.get(this.dataEndpoint)
.pipe(map(response => plainToClass(DataV2, response as Object[], { groups: ['get'] })));
}
In the network tab I get a 400 error with this response:
Here is the start of my 400 console error from the GET call:
Here is my package.json:
"dependencies": {
"#angular/animations": "9.1.6",
"#angular/cdk": "9.2.3",
"#angular/common": "9.1.6",
"#angular/compiler": "9.1.6",
"#angular/core": "9.1.6",
"#angular/flex-layout": "~9.0.0-beta.29",
"#angular/forms": "9.1.6",
"#angular/material": "9.2.3",
"#angular/platform-browser": "9.1.6",
"#angular/platform-browser-dynamic": "9.1.6",
"#angular/router": "9.1.6",
"#auth0/angular-jwt": "^4.0.0",
"#ngrx/effects": "~9.1.2",
"#ngrx/router-store": "~9.1.2",
"#ngrx/store": "~9.1.2",
"#ngrx/store-devtools": "~9.1.2",
"#nrwl/nx": "6.3.1",
"class-transformer": "0.1.9",
"classlist.js": "^1.1.20150312",
"core-js": "~3.6.5",
"es6-shim": "^0.35.5",
"file-saver": "^2.0.2",
"hammerjs": "2.0.8",
"highcharts": "~8.1.0",
"moment": "~2.25.3",
"ng2-file-upload": "^1.4.0",
"ngx-toastr": "^12.0.1",
"ramda": "^0.27.0",
"reflect-metadata": "~0.1.13",
"rxjs": "~6.5.5",
"rxjs-compat": "~6.5.5",
"tachyons-sass": "^4.9.5",
"tslib": "^1.11.2",
"typedjson": "^1.5.1",
"zone.js": "~0.10.3"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.901.5",
"#angular-devkit/core": "9.1.5",
"#angular-devkit/schematics": "9.1.5",
"#angular/cli": "9.1.5",
"#angular/compiler-cli": "9.1.6",
"#angular/language-service": "9.1.6",
"#nrwl/schematics": "8.12.11",
"#schematics/angular": "9.1.3",
"#types/highcharts": "5.0.4",
"#types/jasmine": "^3.5.10",
"#types/jasminewd2": "~2.0.8",
"#types/node": "^13.13.4",
"codelyzer": "^5.2.2",
"fibers": "^3.1.0",
"html-webpack-plugin": "^4.2.1",
"jasmine-core": "^3.5.0",
"jasmine-marbles": "0.3.1",
"jasmine-spec-reporter": "^5.0.2",
"karma": "~5.0.5",
"karma-chrome-launcher": "^3.1.0",
"karma-cli": "^2.0.0",
"karma-coverage-istanbul-reporter": "^3.0.2",
"karma-jasmine": "^3.1.1",
"karma-jasmine-html-reporter": "^1.5.3",
"ng-mocks": "^9.3.0",
"node-sass": "^4.14.0",
"prettier": "^1.18.2",
"protractor": "^5.4.4",
"remote-redux-devtools": "^0.5.16",
"ts-node": "~8.10.1",
"tslint": "~6.1.2",
"typescript": "~3.8.3"
}
Everything works fine in Angular 8. This error only occurs on my current branch where I am trying to update to the latest Angular 9. But I'm not sure how a front end issue could be causing the error I'm seeing. Could this be a problem with one of the NPM package updates?
Any help is appreciated.
Try these steps:
Delete node-modules folder C:\Users\USER\AppData\Roaming\npm\node_modules
Open windows powershell as admin
npm cache clean --force
npm install -g npm#latest
npm uninstall -g angular-cli
npm install -g #angular/cli#latest
My routing was not working correctly, I have separate paths for two components but still they were shown one below the other in second component's path, reason: below error in my console,
Inspite of trying the solution given here ANGULAR 6: error TS2315: Type 'ModuleWithProviders' is not generic,
I am still getting same error, and now it is not even compiling.
I am searching solution since past few hours but no luck.
ERROR in node_modules/#angular/platform-browser/src/browser.d.ts(45,9): error TS2315: Type >'ModuleWithProviders' is not generic.
node_modules/#angular/router/src/router_module.d.ts(101,60): error TS2315: Type >'ModuleWithProviders' is not generic.
node_modules/#angular/router/src/router_module.d.ts(105,38): error TS2315: Type >'ModuleWithProviders' is not generic.
Below is my package.json,
{
"name": "cakewale",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "^6.0.0",
"#angular/cdk": "^6.0.0",
"#angular/common": "^6.0.3",
"#angular/compiler": "^6.0.3",
"#angular/core": "6.0.3",
"#angular/forms": "6.0.3",
"#angular/http": "^6.0.3",
"#angular/platform-browser": "^6.0.3",
"#angular/platform-browser-dynamic": "^6.0.3",
"#angular/router": "^6.0.3",
"animate.css": "^3.7.2",
"core-js": "^2.5.4",
"rxjs": "6.0.0",
"wowjs": "^1.1.3",
"zone.js": "^0.8.26"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.6.8",
"#angular/cli": "~6.0.8",
"#angular/compiler-cli": "^6.0.3",
"#angular/language-service": "^6.0.3",
"#types/jasmine": "~2.8.6",
"#types/jasminewd2": "~2.0.3",
"#types/node": "~8.9.4",
"codelyzer": "~4.2.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.0",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.3.0",
"shallow-render": "^7.2.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1",
"typescript": "~2.7.2"
}
}
I was thinking to change the versions to 6.1.2, but I am scared it might result in altogether new errors, would anyone recommend that?
I am not able to figure out what am I missing, please help.
Thanks for any help.
I was trying to use some new libraries and guess accidentally mismatched the versions of #angular/core #angular/router #angular/platform-browser
I removed the ^ sign from versions of all the three above to make sure their versions are exactly same, it worked.
I am getting the below error. when i do "ng build --prod --aot"
ERROR in ./node_modules/ng2-smart-table/ng2-smart-table.ngfactory.js
Module not found: Error: Can't resolve '../#akveo/ng2-completer/ng2-completer.ngfactory' in 'C:\Shruthi\Applications\PULSE\Q2-error\pulse\Pulse-web\node_modules\ng2-smart-table'
everything works fine when i do ng build.
I am getting this error from yesterday everything was working fine in before yesterday.
Is it error because of ng2-completer or something related ng build or angular version.
below is my package.json
{
"name": "pulse-web",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"compodoc": "compodoc",
"generate-docs": "compodoc -p src/tsconfig.app.json",
"serve-docs": "compodoc -s src/tsconfig.app.json"
},
"private": true,
"dependencies": {
"#akveo/ng2-completer": "^9.0.1",
"#amcharts/amcharts4": "^4.9.6",
"#angular/animations": "~7.2.0",
"#angular/cdk": "~7.2.0",
"#angular/common": "~7.2.0",
"#angular/compiler": "~7.2.0",
"#angular/core": "~7.2.0",
"#angular/forms": "~7.2.0",
"#angular/http": "^7.2.16",
"#angular/material": "~7.2.0",
"#angular/platform-browser": "~7.2.0",
"#angular/platform-browser-dynamic": "~7.2.0",
"#angular/router": "~7.2.0",
"#compodoc/compodoc": "^1.1.11",
"#mc-dxp/dxp-styles": "^3.2.1",
"#mc-dxp/dxp-web": "^4.1.1",
"#ng-bootstrap/ng-bootstrap": "^4.1.5",
"#syncfusion/ej2-angular-buttons": "^17.4.49",
"#syncfusion/ej2-angular-lists": "^17.4.47",
"#syncfusion/ej2-angular-navigations": "^17.4.49",
"#types/crypto-js": "^3.1.43",
"acorn": "^6.1.1",
"bootstrap": "^4.4.1",
"core-js": "^2.5.4",
"jquery": "^3.4.1",
"jw-angular-pagination": "^1.1.0",
"moment": "^2.24.0",
"ng2-completer": "^2.0.8",
"ng2-smart-table": "^1.5.0",
"ngx-bootstrap": "^5.3.2",
"ngx-cookie-service": "^2.3.0",
"ngx-select-dropdown": "1.3.0",
"popper.js": "^1.16.1",
"rxjs": "~6.3.3",
"rxjs-compat": "^6.5.4",
"tslib": "^1.9.0",
"zone.js": "~0.8.26"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.13.0",
"#angular/cli": "~7.3.8",
"#angular/compiler-cli": "~7.2.0",
"#angular/language-service": "~7.2.0",
"#types/node": "~8.9.4",
"#types/jasmine": "~2.8.8",
"#types/jasminewd2": "~2.0.3",
"codelyzer": "~4.5.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~3.2.2"
}
}
Pleas help me! Not able to figure out the reason
It seems to be a problem with the library itself. See this: https://github.com/akveo/ng2-smart-table/issues/1143. We are also facing the same problem while upgrading our application to Angular 9.
If you are using Ang 9
Upgrade these libraries to these versions
"ng2-completer": "^9.0.1",
"ng2-smart-table": "^1.6.0",
"typescript": "3.8.3" // note explicit ie no "~" or "^"
TypeError: Cannot read property 'length' of undefined
Console log
Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
at createSourceFile (c:\Users\Amina\Desktop\LendingTree\node_modules\typescript\lib\typescript.js:15457:109)
at parseSourceFileWorker (c:\Users\Amina\Desktop\LendingTree\node_modules\typescript\lib\typescript.js:15389:26)
at Object.parseSourceFile (c:\Users\Amina\Desktop\LendingTree\node_modules\typescript\lib\typescript.js:15338:26)
at Object.createSourceFile (c:\Users\Amina\Desktop\LendingTree\node_modules\typescript\lib\typescript.js:15192:29)
at new TypeScriptFileRefactor (c:\Users\Amina\Desktop\LendingTree\node_modules\#ngtools\webpack\src\refactor.js:34:35)
at Object.resolveEntryModuleFromMain (c:\Users\Amina\Desktop\LendingTree\node_modules\#ngtools\webpack\src\entry_resolver.
js:105:20)
at AotPlugin._setupOptions (c:\Users\Amina\Desktop\LendingTree\node_modules\#ngtools\webpack\src\plugin.js:152:50)
at new AotPlugin (c:\Users\Amina\Desktop\LendingTree\node_modules\#ngtools\webpack\src\plugin.js:27:14)
at _createAotPlugin (c:\Users\Amina\Desktop\LendingTree\node_modules\#angular\cli\models\webpack-configs\typescript.js:55:
12)
at Object.exports.getNonAotConfig (c:\Users\Amina\Desktop\LendingTree\node_modules\#angular\cli\models\webpack-configs\typ
escript.js:71:19)
at NgCliWebpackConfig.buildConfig (c:\Users\Amina\Desktop\LendingTree\node_modules\#angular\cli\models\webpack-config.js:2
9:37)
at Class.run (c:\Users\Amina\Desktop\LendingTree\node_modules\#angular\cli\tasks\serve.js:43:98)
at check_port_1.checkPort.then.port (c:\Users\Amina\Desktop\LendingTree\node_modules\#angular\cli\commands\serve.js:114:26
)
at process._tickCallback (internal/process/next_tick.js:109:7)
Package.Json
{
"name": "lending-tree",
"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": {
"#agm/core": "^1.0.0-beta.1",
"#angular/animations": "^4.2.4",
"#angular/common": "^4.2.4",
"#angular/compiler": "^4.2.4",
"#angular/core": "^4.2.4",
"#angular/forms": "^4.2.4",
"#angular/http": "^4.2.4",
"#angular/platform-browser": "^4.2.4",
"#angular/platform-browser-dynamic": "^4.2.4",
"#angular/router": "^4.2.4",
"#types/googlemaps": "^3.29.0",
"core-js": "^2.4.1",
"rxjs": "^5.4.2",
"zone.js": "^0.8.14"
},
"devDependencies": {
"#angular/cli": "1.3.1",
"#angular/compiler-cli": "^4.2.4",
"#angular/language-service": "^4.2.4",
"#types/jasmine": "~2.5.53",
"#types/jasminewd2": "~2.0.2",
"#types/node": "~6.0.60",
"codelyzer": "~3.1.1",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.3.2",
"typescript": "~2.3.3"
}
}
I have created a new project with cli ng new projectName
Replaced app folder with my existing project.
Added template for front view in the root directory of an application.
Updated index.html only added some css and scripts.
Moved main.ts src to app folder, and changed the imports statements.
That are only changes, I have made so far.
When I install the plugin it gets successfully installed but I get the following message in my terminal:
nativescript-google-maps-sdk 3.0.0 for ios is not compatible with the
currently installed framework version 2.5.0.
This is my package.json
{
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"nativescript": {
"id": "org.nativescript.virtualreality",
"tns-ios": {
"version": "2.5.0"
}
},
"dependencies": {
"#angular/animations": "~4.0.0",
"#angular/common": "~4.0.0",
"#angular/compiler": "~4.0.0",
"#angular/core": "~4.0.0",
"#angular/forms": "~4.0.0",
"#angular/http": "~4.0.0",
"#angular/platform-browser": "~4.0.0",
"#angular/platform-browser-dynamic": "~4.0.0",
"#angular/router": "~4.0.0",
"email-validator": "^1.0.7",
"nativescript-angular": "~1.5.1",
"nativescript-google-maps-sdk": "^2.0.2",
"nativescript-plugin-firebase": "^3.11.4",
"nativescript-telerik-ui": "^1.6.2",
"nativescript-theme-core": "~1.0.2",
"reflect-metadata": "~0.1.8",
"rxjs": "~5.2.0",
"tns-core-modules": "2.5.2",
"zone.js": "~0.8.2"
},
"devDependencies": {
"nativescript-dev-android-snapshot": "^0.*.*",
"nativescript-dev-typescript": "~0.3.5",
"typescript": "~2.1.0"
}
}
Since the tns 3.0 is still in RC phase I don't want to mess up my project. Isn't there any way of using the google-maps in the 2.5.* version of Nativescript
You have to upgrade you nativescript modules to version ~3... "tns-core-modules": "2.5.2",