Recently, I upgraded my Angular project from version 2 to version 4. The steps I followed for this upgrade are as follows:
1- Deleted the /node_modules/ folder
2- Executed the following command:
npm install @angular/common@latest @angular/compiler@latest @angular/compiler-cli@latest @angular/core@latest @angular/forms@latest @angular/http@latest @angular/platform-browser@latest @angular/platform-browser-dynamic@latest @angular/platform-server@latest @angular/router@latest @angular/animations@latest typescript@latest --save
This was done in order to update the versions listed in package.json.
3- Ran npm install
++However, at the end of the process, an unusual link is visible within the tree structure:
https://i.sstatic.net/bmEvP.png
4- Ran ng build
The error message displayed after running ng build was:
ERROR in PATH/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts (133,11): All declarations of 'WeakMap' must have identical type parameters.
ERROR in PATH/node_modules/typescript/lib/lib.es2015.iterable.d.ts (124,11): All declarations of 'WeakMap' must have identical type parameters.
ERROR in PATH/node_modules/typescript/lib/lib.es2015.collection.d.ts (45,11): All declarations of 'WeakMap' must have identical type parameters.
ERROR in PATH/node_modules/@types/lodash/index.d.ts (19417,15): All declarations of 'WeakMap' must have identical type parameters.
When I inspected one of the classes mentioned above, an additional error message appeared: https://i.sstatic.net/ZAEuW.png
The message indicated 'cannot find type object.'
Based on my background in Java, it seems that the compiler is interpreting 'object' differently than what is expected by the library. Ideally, 'Object' should be used as a concrete class or interface. Any suggestions?
Here is the content of my package.json file:
{
"name": "rats-gui",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"ng": "ng",
"start": "ng serve",
........(Content truncated for brevity)......
"tslint": "^4.3.0",
"typescript": "2.1.5"
}
}