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:
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.
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.
install Node.js Windows Installer 64-bit: https://nodejs.org/en/download/ node-v6.11.0-x64.msi
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
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/
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".
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.
Install TypeScript:
npm install -g typescript@latest
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
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.
Install AngularJS:
npm install angular (my version: 1.6.5)
Install Angular commandline-tool: npm install -g @angular/cli@latest (@angular/cli is the new name for angular-cli)
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)
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:
Links: