Removing a standard project
If you created an Angular project using the command ng new <project_name>
, you can remove it using the following steps:
- Open the terminal or command prompt and navigate to the parent directory where the Angular workspace is located.
- The
command created a folder namedng new <project_name>
in the workspace directory. To remove this project, simply delete this folder.<project_name>
Linux
rm -rf
<project_name>
Windows
rmdir /s /q <project_name>
Replace
with the name of your project.<project_name>
Removing a multiple applications project
To remove an Angular project created with the ng g application <project_name>
command, you can follow these steps:
- Open the terminal or command prompt and navigate to the parent directory where the Angular workspace is located.
- The
ng
g application
command created a folder named<project_name>
in the projects folder in the workspace directory. To remove this project, simply delete this folder.<project_name>
- Remove references to the deleted project.
Deleting project folder
Linux
rm -rf
<project_name>
Windows
rmdir /s /q <project_name>
Replace
with the name of your project.<project_name>
Removing references to the deleted project
If you want to remove any references to the deleted project from your Angular CLI configuration, you can manually delete them from the angular.json
file located in your workspace root. Look for the projects section in the angular.json
file and remove the configuration related to the deleted project.
Example of the my-project configuration in the angular.json file
"my-project": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "projects/my-project",
"sourceRoot": "projects/my-project/src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:application",
"options": {
"outputPath": "dist/my-project",
"index": "projects/my-project/src/index.html",
"browser": "projects/my-project/src/main.ts",
"polyfills": [
"zone.js"
],
"tsConfig": "projects/my-project/tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
"projects/my-project/src/favicon.ico",
"projects/my-project/src/assets"
],
"styles": [
"projects/my-project/src/styles.scss"
],
"scripts": [],
"server": "projects/my-project/src/main.server.ts",
"prerender": true,
"ssr": {
"entry": "projects/my-project/server.ts"
}
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"buildTarget": "my-project:build:production"
},
"development": {
"buildTarget": "my-project:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"buildTarget": "my-project:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "projects/my-project/tsconfig.spec.json",
"inlineStyleLanguage": "scss",
"assets": [
"projects/my-project/src/favicon.ico",
"projects/my-project/src/assets"
],
"styles": [
"projects/my-project/src/styles.scss"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"projects/my-project/**/*.ts",
"projects/my-project/**/*.html"
]
}
}
}
}