'Unknown option: '--base-href' Angular 13 ng serve
im creating an angular 13app using CLI i want to set a path to my app when i run it i got the following error :
Unknown option: '--base-href'
Unknown option: '/my-path/'
this is the command i run :
ng serve --base-href /my-path/
and
ng serve --base-href=/my-path/
and this are my dep :
"dependencies": {
"@angular/animations": "~13.2.0",
"@angular/common": "~13.2.0",
"@angular/compiler": "~13.2.0",
"@angular/core": "~13.2.0",
"@angular/forms": "~13.2.0",
"@angular/platform-browser": "~13.2.0",
"@angular/platform-browser-dynamic": "~13.2.0",
"@angular/router": "~13.2.0",
"@ng-bootstrap/ng-bootstrap": "^4.1.1",
"@reactivex/rxjs": "^6.6.7",
"angular-oauth2-oidc": "^13.0.1",
"bootstrap-icons": "^1.8.1",
"font-awesome": "^4.7.0",
"rxjs": "~7.5.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
any one have an idea about this isuue please and how i can set a path to my app in localhost ?
Regards
Solution 1:[1]
This option has been deprecated. You should set it in angular.json, here :
"acme-project": {
[...]
"architect": {
"build": {
"options": {
"baseHref": "/my-path/",
Solution 2:[2]
Adding to Arnauds answer.
If you don't want to change the baseHref for your development and perhaps not all builds, you should add baseHref to 'configurations' on selected config, and not to 'options.
f ex: in my project AngularExamplesAndSnippets i add the baseHref to my "github-pages" configuration
if you build for production you add it below "production"
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
...
},
"configurations": {
"github-pages": {
"baseHref": "/AngularExamplesAndSnippets/",
...
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Arnaud Denoyelle |
| Solution 2 | JimiSweden |
