0

How do we update angular to its latest version and whats a best practice to update the package.json accordingly, I need to update @angular 2.2.0 to @angular 2.2.3, please can someone write here npm command? I need a update because angular google map is not working with previous version, the application throws an exception any idea why? Your answers will be much appreciated :)

app/listings/residentialListing/shared/resListing.service.ts(22,27):
error TS2339: Property 'find' does not exist on type 'Res
identialListingModel[]'.
app/listings/residentialListing/shared/resListing.service.ts(22,32):
error TS7006: Parameter 'listing' implicitly has an 'any'  type.
node_modules/@agm/core/services/managers/marker-manager.d.ts(9,25):
error TS2304: Cannot find name 'Map'.
node_modules/@angular/common/src/directives/ng_class.d.ts(48,34):
error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/aot/compiler.d.ts(56,32): error
TS2304: Cannot find name 'Map'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(371,20):
error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(373,28):
error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(375,15):
error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(377,23):
error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(379,17):
error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(381,25):
error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/output/output_ast.d.ts(458,63):
error TS2304: Cannot find name 'Set'.
node_modules/@angular/core/src/change_detection/differs/default_iterable_differ.d.ts(28,32):
error TS2304: Cannot find name 'I terable'.
node_modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.d.ts(24,16):
error TS2304: Cannot find name 'M ap'.
node_modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.d.ts(32,16):
error TS2304: Cannot find name 'M ap'.
node_modules/@angular/core/src/change_detection/differs/iterable_differs.d.ts(15,48):
error TS2304: Cannot find name 'Iterable '.
node_modules/@angular/core/src/change_detection/differs/keyvalue_differs.d.ts(23,18):
error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/di/reflective_provider.d.ts(87,123):
error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/di/reflective_provider.d.ts(87,165):
error TS2304: Cannot find name 'Map'.
node_modules/@angular/http/src/headers.d.ts(52,71): error TS2304:
  Cannot find name 'Map'.
node_modules/@angular/http/src/url_search_params.d.ts(46,16): error
TS2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(79,33):
error TS2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/dom/dom_adapter.d.ts(97,42):
error TS2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/dom/shared_styles_host.d.ts(11,30):
error TS2304: Cannot find name 'Set'.
node_modules/@angular/platform-browser/src/dom/shared_styles_host.d.ts(22,30):
error TS2304: Cannot find name 'Set'.
node_modules/@angular/router/src/router_outlet_context.d.ts(42,28):
error TS2304: Cannot find name 'Map'.
node_modules/@angular/router/src/router_outlet_context.d.ts(43,34):
error TS2304: Cannot find name 'Map'.
node_modules/rxjs/Observable.d.ts(58,60): error TS2693: 'Promise' only
refers to a type, but is being used as a value here.
node_modules/rxjs/operator/toPromise.d.ts(3,79): error TS2693:
  'Promise' only refers to a type, but is being used as a value h ere.
npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR!
product-management@1.0.0 start: `tsc && concurrently "tsc -w"
"lite-server" ` npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the
product-management@1.0.0 start script. npm ERR! This is probably not a
problem with npm. There is likely additional logging output above.
>
npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\Amina\AppData\Roaming\npm-cache\_logs\2017-10-02T17_11_05_451Z-debug.log
tao
  • 82,996
  • 16
  • 114
  • 150
Amina
  • 71
  • 9
  • https://angular-update-guide.firebaseapp.com/ – yurzui Oct 02 '17 at 16:45
  • I need a update because angular google map is not working with previous version, the application throws an exception any idea why? – Amina Oct 02 '17 at 16:48
  • Post your code in the exact exception – yurzui Oct 02 '17 at 16:49
  • Just updated my question please check that out. – Amina Oct 02 '17 at 16:52
  • https://stackoverflow.com/questions/41285889/ctorparameters-map-is-not-a-function-in-angular2-mdl Yeah, you need to update angular – yurzui Oct 02 '17 at 16:54
  • Show your package.json – yurzui Oct 02 '17 at 16:54
  • Yes Yurzui, let me try with this :) – Amina Oct 02 '17 at 16:55
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/155776/discussion-between-amina-and-yurzui). – Amina Oct 02 '17 at 16:57
  • updated please check my question. – Amina Oct 02 '17 at 16:59
  • 1
    Change all `2.1.2` to for example `4.3.6`. Remove node_modules and run `npm i` – yurzui Oct 02 '17 at 17:00
  • I have jst updated the version and package.json, np luck application still not working, please check the updated question for the list of exceptions? – Amina Oct 02 '17 at 17:14
  • Andrei problem is not how to update the latest version, i already did issue is that I am unable to run the application after installing and registering @agm. – Amina Oct 02 '17 at 17:16
  • In that case you want to change its title. It's misleading. It should be *"how to update Angular to specific version"*, IMHO - which is a much more useful question than the current *"How to update Angular to latest version"* (which basically says - *i'm too lazy to read the docs*). I hope you agree, it's nothing personal. It's all about what is and what is not considered acceptable on [so]. – tao Oct 02 '17 at 17:19
  • Just updated! Andrei – Amina Oct 02 '17 at 17:22
  • I retracted my vote. Cheers! – tao Oct 02 '17 at 17:25
  • Thanks man! much appreciated. – Amina Oct 02 '17 at 17:27

1 Answers1

0

For updating angular to the last version just run the next commands from npm console:

Windows

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

Linux

npm install @angular/{common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-server,router,animations}@latest typescript@latest --save

Remember to run it from the folder where you have angular installed. For that:

-- Open npm console (the application you run when you want to compile any angular project. It looks like CMD windows console).

-- Navigate until the folder where you have angular installed (NodeJS) (Normally in ProgramFiles).

-- Paste this command and run it.

I tested windows version and it works for me...

Hope it helps, let me know any doubt.

Kenzo_Gilead
  • 2,187
  • 9
  • 35
  • 60
  • Elias, I am done with that no luck still application throws different exceptions, seems like @agm causing an actual problem. Please check my updated question. – Amina Oct 02 '17 at 17:25
  • Hi @Amina. Did you do it from Angular folder? – Kenzo_Gilead Oct 02 '17 at 17:27
  • I mean you have to run this command from angular folder for checking all components and the links of them. Specifically, I didn´t check agm, but very first I run this command out of angular folder and I had a few errors finding different components... – Kenzo_Gilead Oct 02 '17 at 17:32
  • No, i just pick up it from index file open in terminal then executed, I need to run it again? – Amina Oct 02 '17 at 17:34
  • Just updated versions from angular folder, app throws same list of exceptions, mention in the question. – Amina Oct 02 '17 at 17:40
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/155780/discussion-between-elias-mp-and-amina). – Kenzo_Gilead Oct 02 '17 at 17:47