0

When I'm trying to create a new project in Angular using ng new my-first-project I get the result as follows:

? Would you like to add Angular routing? Yes
? Which stylesheet format would you like to use? CSS
CREATE my-first-project/angular.json (3646 bytes)
CREATE my-first-project/package.json (1249 bytes)
CREATE my-first-project/README.md (1031 bytes)
CREATE my-first-project/tsconfig.json (489 bytes)
CREATE my-first-project/tslint.json (3125 bytes)
CREATE my-first-project/.editorconfig (274 bytes)
CREATE my-first-project/.gitignore (631 bytes)
CREATE my-first-project/browserslist (429 bytes)
CREATE my-first-project/karma.conf.js (1028 bytes)
CREATE my-first-project/tsconfig.app.json (210 bytes)
CREATE my-first-project/tsconfig.spec.json (270 bytes)
CREATE my-first-project/src/favicon.ico (948 bytes)
CREATE my-first-project/src/index.html (300 bytes)
CREATE my-first-project/src/main.ts (372 bytes)
CREATE my-first-project/src/polyfills.ts (2835 bytes)
CREATE my-first-project/src/styles.css (80 bytes)
CREATE my-first-project/src/test.ts (753 bytes)
CREATE my-first-project/src/assets/.gitkeep (0 bytes)
CREATE my-first-project/src/environments/environment.prod.ts (51 bytes)
CREATE my-first-project/src/environments/environment.ts (662 bytes)
CREATE my-first-project/src/app/app-routing.module.ts (246 bytes)
CREATE my-first-project/src/app/app.module.ts (393 bytes)
CREATE my-first-project/src/app/app.component.html (25757 bytes)
CREATE my-first-project/src/app/app.component.spec.ts (1089 bytes)
CREATE my-first-project/src/app/app.component.ts (220 bytes)
CREATE my-first-project/src/app/app.component.css (0 bytes)
CREATE my-first-project/e2e/protractor.conf.js (808 bytes)
CREATE my-first-project/e2e/tsconfig.json (214 bytes)
CREATE my-first-project/e2e/src/app.e2e-spec.ts (649 bytes)
CREATE my-first-project/e2e/src/app.po.ts (301 bytes)
- Installing packages...'npm' is not recognized as an internal or external command,
operable program or batch file.
"× Package install failed, see above."
The Schematic workflow failed. See above.

Can anyone help me with this error, every single time I'm trying to create a new project I'm getting the same error.

Aluan Haddad
  • 29,886
  • 8
  • 72
  • 84
  • It has nothing to do with angular. It means that npm is not in your path for some reason. Make sure you have installed the latest version of node and that when you install it you select all the defaults. If the problem persists, look up how to modify the path environmental variable for your operating system – Aluan Haddad Jun 07 '20 at 04:38
  • And next time read the error message! – Aluan Haddad Jun 07 '20 at 04:40
  • Please check this answer: https://stackoverflow.com/questions/20992723/npm-is-not-recognized-as-internal-or-external-command-operable-program-or-bat – Bar Levin Jun 07 '20 at 06:15
  • No, I've checked all the error possibilities and moreover I'm using windows 10 so there is no need to add `;` in my path and all my path settings are clear and no issue with the path. @AluanHaddad – Sateesh Gollapudi Jun 07 '20 at 06:41
  • OK, if you can run `npm -v` in the _same_ shell where `ng new app` fails because it can't find npm, then I agree that there is another issue. – Aluan Haddad Jun 07 '20 at 07:12

1 Answers1

0

First, open your command prompt as Run as administrator there you can install angular using the command npm install -g @angular/cli then it will install globally in your PC. when you try to install the angular into PC using cmd you might open regular cmd, here is the fault that we have to open the cmd in administrator mode then you install your angular. After finishing installation you can run angular by creating a new project using the command ng new first-project then it works fine and you can start your project by npm start or ng serve both will work.