I have installed the angular/cli but ng command is not working as global
C:\Projects>ng -v 'ng' is not recognized as an internal or external command, operable program or batch file.
I have installed the angular/cli but ng command is not working as global
C:\Projects>ng -v 'ng' is not recognized as an internal or external command, operable program or batch file.
Follow the below steps to start with angular CLI.
First update node version:
node -v
.If node version is lower than 6.x.x then update it because angular CLI requires node version to be higher than 6.x.x. To update node version run the below command.
nvm install <new version> --reinstall-packages-from=<old version>
Ex: nvm install 7.10.0 --reinstall-packages-from=5.1.0
Then run command: nvm use 7.10.0
After this run command npm install -g @angular/cli
to install Angular CLI.
ng new my-new-project
to create new project.cd my-new-project
to go inside created project directory.ng serve
to run your app.Extra: To update your angular 2 project into angular 4 project run below command:
* On Linux/Mac: npm install @angular/{common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-
server,router,animations}@next --save server,router,animations}@next --save
* On Windows: npm install @angular/common@next @angular/compiler@next @angular/compiler-cli@next @angular/core@next
@angular/forms@next @angular/http@next @angular/platform-browser@next @angular/platform-browser-dynamic@next
@angular/platform-server@next @angular/ router@next @angular/animations@next --save
In your command line tool use: npm install -g @angular/cli@latest
Make sure you have installed NodeJS first.
Yes, it was related to node version, i have upgraded the node version higher than 6.x.x and now it is working.