which is what I download at https://github.com/angular/angular-cli

1

I want to start working with angular js, I have installed Node.js and when I run the command npm install -g @ angular / cli the execution gives me error which is the cause of this problem, embusqueda of a one solution I found that I can download angular cli from the link that is on the official page link with the GET STARTED link, which redirects me to link I download the whole. and when I check everything is different from the tutotials. someone has some reference as continual.

    
asked by junior molina villa 06.06.2018 в 22:21
source

2 answers

1

@ angular / cli is not the Angular framework. It is a library so you can generate angular projects from the command line:

sudo npm i -g @angular/cli

Leave the executable ng available. Then you can generate a project by running

ng new miproyecto

This will create a folder miproyecto within which there is a scaffold of an Angular application. You enter that folder, you execute npm install and you already have a functional application on which you can start making your additions and modifications.

On the other hand, if you clone the link repo you will not actually have the ng command on your line of command, but you can only run it within your local copy of that repo doing first npm install and then npm run ng , which is not ideal. Better use the path with sudo npm i -g @angular/cli . If you do not have sudo privileges, you can configure npm so that the globally installed packages are installed in your local folder.

For this you must also add the route of those packages to your $ PATH (for example /home/junior_molina/.npm-packages/bin ).

    
answered by 07.06.2018 в 15:39
0

AngularJs and Angular are different frameworks. Keep in mind that what you are installing when doing npm install -g @angular/cli is the client (not the Angular framework) globally, and that will allow you to run the commands. What you want is to install the cli locally in your project directory of angular too (this way you will use that version and if you start new projects you will have a cli x each project to avoid problems of versions).

To start a project and install the dependencies (Angular, cli, etc ...) I followed these steps :

git clone https://github.com/angular/quickstart.git quickstart
cd quickstart
npm install @angular/cli --save  // notá el --save que agrega la dependencia al package.json si el comando falla, tenés algo mal configurado
npm install
npm start

These commands are going to download an angular project template with the basics to boot ... check the package.json file to understand the versions and packages that the project has.

    
answered by 06.06.2018 в 22:32