How do you install angular-cli for windows 7

76,357

Solution 1

Installation of NodeJs, npm, TypeScript, AngularJS, @angular/cli on Windows 7 Professional SP 1 64-bit:

Since I have found many valuable hints scattered on various posts only after 'painful' search, here a compact compilation (not my ideas but my experience). Hope it helps.

  1. install Node.js Windows Installer 64-bit: https://nodejs.org/en/download/ node-v6.11.0-x64.msi

  2. If there is a (company-)proxy (installation behind firewall): configure npm against the company-proxy: open cmd window (not elevated, normally you have to be the login-user)

    npm config set proxy http://Proxy.Company.com:Port (replace Proxy.Company.com:Port with your proxy-settings)

    npm config set https-proxy http://Proxy.Company.com:Port (replace Proxy.Company.com:Port with your proxy-settings)

    Hints: Both settings are required, ask your admins for the correct url. If you need to propagate a user/password use the following syntax:

    npm config set proxy http://user:[email protected]:Port

  3. Set npm directory for packages (npm 3.10.10 comes with Node.js but we'll update it later):

    npm config set registry https://registry.npmjs.org/

  4. Update npm to the latest version:

    npm install npm@latest -g

    Beware: npm update only works with the HTTPS-variant (registry https://registry.npmjs.org/). With the HTTP-setting (see below) you earn "shasum check failed".

  5. Set npm directory for packages to the non-HTTPS-variant:

    npm config set registry http://registry.npmjs.org/

    Reason: the https-variant, which was necessary to update npm itself, does'nt work for all packages, e.g. @angular/cli@latest or angular-cli or typescript@latest either.

  6. Install TypeScript:

    npm install -g typescript@latest

  7. Possibly update Visual Studio 2015 to Update 3 (necessary) (everything also works fine with the Community Edition Update 3): Microsoft Visual Studio Professional 2015 Version 14.0.25422.01 Update 3 Microsoft .NET Framework Version 4.6.01055

  8. Ensure, that Visual Studio fetches the actually installed packages: Tools/Options, left-tree/Projects and Solutions/External Web Tools, right panel, move the $(PATH) entry to the top (above the $(DevEnvDir) entries). Afterwards close Visual Studio.

  9. Install AngularJS:

    npm install angular (my version: 1.6.5)

  10. Install Angular commandline-tool: npm install -g @angular/cli@latest (@angular/cli is the new name for angular-cli)

  11. Check versions (in cmd window; my versions below):

    node -v => v6.11.0

    npm -v => 5.1.0

    tsc -v => 2.4.1

    ng --version => 1.2.0 (@angular/cli)

  12. Install optional package installer for Visual Studio (see also section 'Links' below): https://marketplace.visualstudio.com/items?itemName=MadsKristensen.PackageInstaller (...Downloads\Package Installer v2.0.101.vsix)

If something had gone wrong, restart with the following steps:

  • In C:\Users\<User>\AppData\Roaming delete the directory 'npm'
  • In cmd window: npm cache clean or possibly: npm cache clean --force
  • run node-v6.11.0-x64.msi in repair-mode
  • continue with Item (2.).

Links:

Solution 2

Latest versions of Node.js and Angular CLI can be setup on Windows 7 in few simple steps:

Step 1: Download Node.js

Download the latest release of Node.js from: Nodejs downloads page. I have downloaded Node.js for Windows 64-bit and the filename is: node-v8.9.3-x64.msi

Step 2: Install Node.js for Windows.

In Windows Explorer, locate the downloaded Nodejs .msi file. Double-click the .msi file. A set of screens will appear to guide you through the installation process. This will install Node.js and Node Package Manager (NPM) on your machine.

Step 3: Verify Node.js Installation

Type the following commands to check the versions of Node.js and NPM

node -v
npm -v

Step 4: Install Angular CLI

Angular Command Line Interface (CLI) is the easiest way to create new Angular projects. Execute the following NPM command to install Angular CLI:

npm install @angular/cli -g

After this installation, the CLI tool can be accessed by using ng commands.

Step 5: Verify Angular CLI

Type the command:

ng -v

I have also put all these steps in my blog: Setup Node.js and Angular CLI

Solution 3

Test It!

node -v

To see if Node is installed, type the above on your command line.

npm -v

To see if npm is installed, type the above on your command line. Installing @angular/cli

npm install @angular/cli

To add this npm package to your local machine, type the above into your command line. You’ll notice a node_modules directory appear in your root where the package is now installed.

If you're having trouble installing packages, check out the helpful docs for installing npm packages locally

Solution 4

Please note that NG.cmd is installed normally at:

C:\Users\Administrator\AppData\Roaming\npm\ng.cmd

...where Administrator could be a user name.

Solution 5

Step 1: Download Node.js

Download the latest release of Node.js from: Nodejs downloads page. I have downloaded Node.js for Windows 64-bit and the filename is: node-v8.9.3-x64.msi

Step 2: Install Node.js for Windows.

In Windows Explorer, locate the downloaded Nodejs .msi file. Double-click the .msi file. A set of screens will appear to guide you through the installation process. This will install Node.js and Node Package Manager (NPM) on your machine.

Step 3: Verify Node.js Installation

Type the following commands to check the versions of Node.js and NPM

node -v npm -v

Step 4: Install Angular CLI

Angular Command Line Interface (CLI) is the easiest way to create new Angular projects. Execute the following NPM command to install Angular CLI: Step 1: Download Node.js

Download the latest release of Node.js from: Nodejs downloads page. I have downloaded Node.js for Windows 64-bit and the filename is: node-v8.9.3-x64.msi

Step 2: Install Node.js for Windows.

In Windows Explorer, locate the downloaded Nodejs .msi file. Double-click the .msi file. A set of screens will appear to guide you through the installation process. This will install Node.js and Node Package Manager (NPM) on your machine.

Step 3: Verify Node.js Installation

Type the following commands to check the versions of Node.js and NPM

node -v npm -v

Step 4: Install Angular CLI This command will install latest version of angular command line.

npm i -g @angular/cli

Share:
76,357

Related videos on Youtube

tgrim90
Author by

tgrim90

i am a coder

Updated on July 09, 2022

Comments

  • tgrim90
    tgrim90 almost 2 years

    I am trying to install angular-cli for windows. I know the command is npm install -g angular-cli, however once I run this command I then try to do ng new however I get an error saying "ng is not a recognized command" I checked the other questions on here saying that you have to add the folder to the PATH variable, however when I check in the folder I've tried to install angular-cli into I don't even see anything.

    Here you can see I've installed the angular-cli using the provided command and that any use of the "ng" command registers and error:

    x

    And here you can see an empty folder with no angular-cli folders or anything for that matter:

    And here you can see an empty folder with no angular-cli folders or anything for that matter

    PLEASE NOTE I am very new to cmd and angular and I really have no idea what steps to take here.

    • Daniel A. White
      Daniel A. White over 7 years
      have you restarted your cmd instance?
    • tgrim90
      tgrim90 over 7 years
      @DanielA.White if you mean did I close cmd and try to run ng new test-app again yes I've tried that.
    • Andriy
      Andriy over 7 years
      your global npm installation for angular-cli in your case is located at 'C:\Users\Owner\AppData\Roaming\npm\node_modules\angular-cli‌​' (you can get it by running 'npm root -g' command). So, try to add its bin folder (where ng executable is located) to the PATH variable
    • tgrim90
      tgrim90 over 7 years
      @Andriy here is my path variable C:\Users\Owner\AppData\Local\atom\bin;C:\Users\Owner\AppData‌​\Roaming\npm\node_mo‌​dules\angular-cli\bi‌​n; I added the bin folder and I still get ng is not recognized.
    • Andriy
      Andriy over 7 years
      weird, try to run it with full path: C:\Users\Owner\AppData‌​\Roaming\npm\node_mo‌​dules\angular-‌​cli\bi‌​n\ng new test-app, and restart your cmd instance
    • Andriy
      Andriy over 7 years
      also try to install and use git bash for windows (openhatch.org/missions/windows-setup/install-git-bash) instead of cmd
    • tgrim90
      tgrim90 over 7 years
      @Andriy the cmd does not work, still says ng is not recognizable. and if possible i prefer not to install anything new on my machine.
    • tgrim90
      tgrim90 over 7 years
      @Andriy is it possible to do without installing git bash? I took a look and it seems complicated, I'd like to stick with learning how to do it on the cmd, before adding another program.
    • Brocco
      Brocco over 7 years
      @user7455422 Can you ensure that the contents of this folder (C:\Users\Owner\AppData‌​\Roaming\npm\node_mo‌​dules) contains a folder named angular-cli inside of it? This will verify that the CLI was actually installed to your machine.
    • tgrim90
      tgrim90 over 7 years
      @Brocco yes it does.
    • Brocco
      Brocco over 7 years
      @user7455422 then you should be able to run this command from anywhere on your machine... C:\Users\Owner\AppData‌​\Roaming\npm\node_mo‌​dules\angular-‌​cli\bin\ng new project-name and if that does not work, please refer to this answer about using global npm packages on windows: stackoverflow.com/questions/9587665/…
    • tgrim90
      tgrim90 over 7 years
      @Brocco but i can't, i get ng not recognized.
    • Suraj
      Suraj over 5 years
      Here look at the step by step guide to install angular CLI tutorialfunda.com/angular/…
  • Youcef Laidani
    Youcef Laidani over 6 years
    If you are run behind a proxy you can follow this tuto jjasonclark.com/how-to-setup-node-behind-web-proxy
  • Trupti
    Trupti about 6 years
    installation of cli giving me lots of error but finally npm install @angular/cli -g worked!..thanks