I did an
npm i
npm -g @angular/cli
Then when I do
ng serve
I am getting this error
But I I put ng serve in npm script (npm start in package.json) it works.
To solve the error "ng: command not found", install the angular cli package globally by running npm install -g @angular/cli@latest and restart your terminal. If the command fails, run it with sudo and make sure the correct PATH is set in your system's environment variable.
To solve the error "ng is not recognized as an internal or external command, operable program or batch file", install the angular cli globally by running npm install -g @angular/cli@latest and make sure your PATH environment variable is set up correctly.
To get the application running, the ng serve command must execute within the [name-of-app] folder. Anywhere within the folder will do. The Angular CLI must recognize that it is within an environment generated with ng new . It will run provided this one condition.
This is mostly because of bulky source map files. When you do ng serve , Angular serves the app from memory instead of the dist folder (the file system). This means the entire code (along with map files) will be loaded into the system's memory and this is the main reason why your system or IDE getting slow.
You need to install angular-cli and create a project using ng command.
You can follow the steps here
npm uninstall -g angular-cli @angular/cli
npm cache clean
npm install -g @angular/cli
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With