question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot read property 'baseHref' of undefined

See original GitHub issue

Describe the bug

When using ng serve, I get this:

Cannot read property 'baseHref' of undefined
TypeError: Cannot read property 'baseHref' of undefined
    at GenericDevServerBuilder._buildServePath (/Users/seiyria/GitHub/deck-zone-ng7/node_modules/@angular-devkit/build-angular/src/dev-server/index.js:233:80)
    at GenericDevServerBuilder._buildServerConfig (/Users/seiyria/GitHub/deck-zone-ng7/node_modules/@angular-devkit/build-angular/src/dev-server/index.js:123:32)
    at GenericDevServerBuilder._buildServerConfig (/Users/seiyria/GitHub/deck-zone-ng7/node_modules/@angular-builders/dev-server/src/generic/index.js:11:109)
    at MergeMapSubscriber.check_port_1.checkPort.pipe.operators_1.concatMap [as project] (/Users/seiyria/GitHub/deck-zone-ng7/node_modules/@angular-devkit/build-angular/src/dev-server/index.js:41:47)
    at MergeMapSubscriber._tryNext (/Users/seiyria/GitHub/deck-zone-ng7/node_modules/rxjs/internal/operators/mergeMap.js:69:27)
    at MergeMapSubscriber._next (/Users/seiyria/GitHub/deck-zone-ng7/node_modules/rxjs/internal/operators/mergeMap.js:59:18)
    at MergeMapSubscriber.Subscriber.next (/Users/seiyria/GitHub/deck-zone-ng7/node_modules/rxjs/internal/Subscriber.js:67:18)
    at TapSubscriber._next (/Users/seiyria/GitHub/deck-zone-ng7/node_modules/rxjs/internal/operators/tap.js:65:26)
    at TapSubscriber.Subscriber.next (/Users/seiyria/GitHub/deck-zone-ng7/node_modules/rxjs/internal/Subscriber.js:67:18)
    at MergeMapSubscriber.notifyNext (/Users/seiyria/GitHub/deck-zone-ng7/node_modules/rxjs/internal/operators/mergeMap.js:92:26)
    at InnerSubscriber._next (/Users/seiyria/GitHub/deck-zone-ng7/node_modules/rxjs/internal/InnerSubscriber.js:28:21)
    at InnerSubscriber.Subscriber.next (/Users/seiyria/GitHub/deck-zone-ng7/node_modules/rxjs/internal/Subscriber.js:67:18)
    at ForkJoinSubscriber.notifyComplete (/Users/seiyria/GitHub/deck-zone-ng7/node_modules/rxjs/internal/observable/forkJoin.js:82:25)
    at InnerSubscriber._complete (/Users/seiyria/GitHub/deck-zone-ng7/node_modules/rxjs/internal/InnerSubscriber.js:35:21)
    at InnerSubscriber.Subscriber.complete (/Users/seiyria/GitHub/deck-zone-ng7/node_modules/rxjs/internal/Subscriber.js:79:18)
    at MapSubscriber.Subscriber._complete (/Users/seiyria/GitHub/deck-zone-ng7/node_modules/rxjs/internal/Subscriber.js:97:26)

To Reproduce Steps to reproduce the behavior:

https://github.com/seiyria/deck.zone/tree/ng7

npm i && npm start

Expected behavior No error when trying to serve

Builder:

  • dev-server:generic & custom-webpack:browser, both at 7.2.0

Libraries

  • angular-devkit/build-angular: 0.11.0

Additional context None

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
amhazeemcommented, Mar 13, 2019

Issue still exists in 7.4.5 alongside devkit 0.7.5

1reaction
yannbfcommented, Jan 11, 2019

@meltedspark 7.2.1 is working indeed! Found out that the problem was that I was using angular-devkit/build-angular@0.11.0. Once I upgraded it, it worked fine! Thanks 😃)

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read property 'baseHref' of undefined
After updating the package.json to use to following version, it was resolved. "devDependencies": { "@angular-builders/custom-webpack": ...
Read more >
Hi, got error `Cannot read property 'baseHref' of undefined` with
Has anyone met something similar ?. “Hi, got error `Cannot read property 'baseHref' of undefined` with” is published by Max Ivanov.
Read more >
Error: No base href set." after upgrade to Angular 8-angular.js
Coding example for the question "Error: No base href set. ... Angular 2+ - Set base href dynamically · ERROR in Cannot read...
Read more >
HTML DOM Base href Property - W3Schools
The href property sets or returns the value of the href attribute in a base element. The href attribute specifies a base URL...
Read more >
Cannot read property 'baseUrl' of undefined - Bountysource
angular.js:14642 TypeError: Cannot read property 'baseUrl' of undefined at new controller (formio.js:15713)
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found