Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular cli not using global npm install

I am new to npm and node, i am learning angular.

In an angular cli project, whenever i run ng <<'keyword'>> command, i am getting below error as its unable to find global npm-modules folder.

node_modules appears empty, you may need to run npm install

Tried following configuration but no luck, i have to run npm install in every project to overcome the problem.

export NODE_PATH=/usr/local/lib/node_modules
PATH=$PATH:/usr/local/bin/node
PATH=$PATH:/usr/local/bin/npm

Is there way that i can avoid running npm install for every project?

like image 494
prabu Avatar asked Apr 09 '17 10:04

prabu


People also ask

Does npm install install angular cli?

Install Angular CLI globally using npm Explanation: This command will install the angular cli package globally. After succesful install, command 'ng' should be available to use.

Does angular cli need to be installed globally?

Installing @angular/cli globally allow you to use 'ng' command everywhere. It's required to install locally because to your project, some specific @angular/cli version is required and newer versions maybe brake.

How do I download angular cli using npm?

Install Angular CLI (Angular command line interface) Open the link https://cli.angular.io/ and follow the instructions to install Angular CLI and to create your first Angular app. Type the command “npm install -g @angular/cli” on the command prompt and press enter to install Angular cli.

What is the difference between npm install and npm install angular cli?

NPM is basically a package manager which acts as a dependency provider. If there are many small packages, required to build a large one, NPM is the one hotspot which will provide us with the packages. Angular-CLI is one of those packages. As far as NG is concerned, it is the core module of Angular.


1 Answers

i got the same error when I tried to run ng serve command after running ng new myapp and creating my project folder. This error occured because I didn't move in to the myapp folder I created. Once I used the cd myapp command and moved in to the folder ng serve worked successfully.

like image 61
Sithija Piyuman Thewa Hettige Avatar answered Oct 11 '22 13:10

Sithija Piyuman Thewa Hettige