Home > Software engineering >  Installing dependencies with npm-peer-dependencies
Installing dependencies with npm-peer-dependencies

Time:02-15

I am trying to install the required node_modules for a small project running Angular 11 using npm install

My goal is get the project to work locally after downloading it from GitHub. I have already installed the latest version of the Angular CLI. After running the install command I tried npm start.

I was expecting that after running the install and start command to be able to run the project locally. However the actual result I get after running the install command is the following list of errors:

> ng serve

An unhandled exception occurred: Cannot find module '@angular/compiler'
Require stack:

\node_modules\@angular\compiler-cli\index.js
\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js
\node_modules\@ngtools\webpack\src\index.js
\node_modules\@angular-devkit\build-angular\src\webpack\configs\typescript.js
\node_modules\@angular-devkit\build-angular\src\webpack\configs\index.js
\node_modules\@angular-devkit\build-angular\src\browser\index.js
\node_modules\@angular-devkit\build-angular\src\dev-server\index.js
\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
\node_modules\@angular-devkit\architect\node\index.js
\node_modules\@angular\cli\models\architect-command.js
\node_modules\@angular\cli\commands\serve-impl.js
\node_modules\@angular-devkit\schematics\tools\export-ref.js
\node_modules\@angular-devkit\schematics\tools\index.js
\node_modules\@angular\cli\utilities\json-schema.js
\node_modules\@angular\cli\models\command-runner.js
\node_modules\@angular\cli\lib\cli\index.js
\node_modules\@angular\cli\lib\init.js
\node_modules\@angular\cli\bin\ng

See "angular-errors.log" for further details.

npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file C:\WINDOWS\system32\cmd.exe
npm ERR! errno ENOENT
npm ERR! `ng serve`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the @0.0.16 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

The problem is that this Angular project also has peer dependencies. I installed npm-install-peers package but it seems that simply running npm install afterwards will not install the required peer dependencies. What should I do next to get this Angular project installed locally ?

CodePudding user response:

The issue you are facing is likely because angular cli or npm-peer-dependencies are not installed globally on your machine. The steps that you should take are to make sure of them are globally installed. To install packages globally you need run npm install -g <package_name> npm docs link

In your case for angular cli you should run npm i -g @angular/[email protected] and npm install -g npm-peer-dependencies. Then run npm start.

  • Related