CLI Installation
npm install -g @angular/cli
CLI Update
npm uninstall -g @angular/cli
npm install -g @angular/cli@latest
Even if you update the global CLI, it won't affect the projects you created before with older versions. In that case, the version of a project will have priority so you might want to update the version of the project to match your global version. You can do that by going to the project file and run the following the commands below
rm -rf node_modules
npm uninstall @angular/cli --force
npm install @angular/cli@latest --force
npm i --force
You might have errors after running all the commands above in VS Code. If that is the case, open the global search and find the 'reload window', and run it. This cleans up the project and reflects changes.
Version Checking
Use either of the commands below to check the version
ng version
ng v
A Command for Additional Information for Each Command
For general information, use the command below
ng help
If you want to know more about a certain command, append the help option after the command
ng new --help
Creating a Project
Creating one project,
ng new project-name
After creating a project, move to the project with the command below
cd project-name
Creating Multiple Projects under A Workspace,
Create a workspace
ng new my-workspace --no-create-application
Then move to the workspace
cd my-workspace
Create applications under the workspace
ng generate application my-first-app
Run
ng serve
If you want to open the application window automatically, use this command
References
How to upgrade Angular CLI to the latest version - Stack Overflow
'Frontend > Angular' 카테고리의 다른 글
Angular(Compiler) - JIT VS AOT (1) | 2023.03.21 |
---|---|
Angular - Project Structure (0) | 2023.03.21 |
Lazy Loading (0) | 2023.03.20 |
Angular - How to Use HTTPS in Development (1) | 2023.03.12 |
Angular Forms - Reactive Form (0) | 2023.03.10 |