Angular-cli: How to install the latest angular-cli?

Created on 3 Feb 2017  路  25Comments  路  Source: angular/angular-cli

I found the latest version in github is 1.0.0-beta.30. But it always show my version is 1.0.0-beta.28.3 when I try:

sudo npm i -g angular-cli

What could be wrong? Thanks

Most helpful comment

You can run these two snippets to upgrade from angular-cli to the new package @angular/cli.

npm uninstall -g angular-cli
npm cache clean
npm install -g @angular/cli@latest
rm -rf node_modules dist
npm uninstall --save-dev angular-cli
npm install --save-dev @angular/cli@latest
npm install
ng update

All 25 comments

npm install -g @angular/cli@latest

Docs need to be updated

There is a pull request open for the docs: #4349

You can run these two snippets to upgrade from angular-cli to the new package @angular/cli.

npm uninstall -g angular-cli
npm cache clean
npm install -g @angular/cli@latest
rm -rf node_modules dist
npm uninstall --save-dev angular-cli
npm install --save-dev @angular/cli@latest
npm install
ng update

@grizzm0 Are you not a fan of ng init? 馃槢

@RicardoVaranda The README says ng update nowdays. ;) Pretty sure it used to say ng init tho.

Thanks. Previously I run: npm i -g angular-cli. I think this is the reason.

I'll have to check it out properly, I like the way init makes the second part of your previous post much easier in my opinion I guess it's all a matter of preference :)

@RicardoVaranda you still need to install the new version of the global cli via the npm commands.

Of course, if you read my last comment I simply stated it makes the second part easier, the first part is essential regardless of your choice on upgrade.

After installing latest version I still have a angular-cli folder with two folders inside

  • ast-tools
  • base-href-webpack

is this as defined?

Closing as answered.

First You uninstall the old version of the CLI globally, cleared cache, and then installed the new version CLI globally, following these instructions:

npm uninstall -g angular-cli @angular/cli

npm cache clean

npm install -g @angular/cli@latest

Can anybody help me.I am unable to install CLI.

What problem are you facing @Mitali-Mahanta

Now @angular/cli is working,i reinstall the nodejs latest version(v6.11.1).

This can help you to update the package versions of package.json to the last version
https://www.npmjs.com/package/npm-check-updates

After updating , my terminal shows angular CLI: 1.5.0 .

Is this the latest ?

@vishal2develop Yes, if youre ever unsure you can check at the release tab:
https://github.com/angular/angular-cli/releases

@grizzm0 npm uninstall -g angular-cli missing the @ at angular-cli.
Thanks for the help!

Hey Guys,
Simple things here
I ran

npm install -g @angular/cli
ng new my-app
cd my-app
ng serve

ERROR in Error: No NgModule metadata found for 'AppModule'.
at NgModuleResolver.resolve (/Users/hassaniftikhar/RubymineProjects/angular-projects/my-app/node_modules/@angular/compiler/bundles/compiler.umd.js:20277:23)
at CompileMetadataResolver.getNgModuleMetadata (/Users/hassaniftikhar/RubymineProjects/angular-projects/my-app/node_modules/@angular/compiler/bundles/compiler.umd.js:15230:60)
at visitLazyRoute (/Users/hassaniftikhar/RubymineProjects/angular-projects/my-app/node_modules/@angular/compiler/bundles/compiler.umd.js:31169:104)
at AotCompiler.listLazyRoutes (/Users/hassaniftikhar/RubymineProjects/angular-projects/my-app/node_modules/@angular/compiler/bundles/compiler.umd.js:31137:20)
at AngularCompilerProgram.listLazyRoutes (/Users/hassaniftikhar/RubymineProjects/angular-projects/my-app/node_modules/@angular/compiler-cli/src/transformers/program.js:156:30)
at Function.NgTools_InternalApi_NG_2.listLazyRoutes (/Users/hassaniftikhar/RubymineProjects/angular-projects/my-app/node_modules/@angular/compiler-cli/src/ngtools_api.js:44:36)
at AngularCompilerPlugin._getLazyRoutesFromNgtools (/Users/hassaniftikhar/RubymineProjects/angular-projects/my-app/node_modules/@angular/cli/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:248:66)
at Promise.resolve.then.then (/Users/hassaniftikhar/RubymineProjects/angular-projects/my-app/node_modules/@angular/cli/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:565:50)
at
at process._tickCallback (internal/process/next_tick.js:188:7)

ng -v

Angular CLI: 1.6.5
Node: 8.2.1
OS: darwin x64
Angular: 5.2.1
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.6.5
@angular-devkit/build-optimizer: 0.0.41
@angular-devkit/core: 0.0.28
@ngtools/json-schema: 1.1.0
typescript: 2.5.3
webpack: 3.10.0

@hassaniftikhar check the comment below
https://github.com/angular/angular-cli/issues/8798#issuecomment-355260025

I've solved it after running following instructions!
npm install npm -g
npm install --save-dev @angular/cli@latest
npm install
npm start

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings