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.

Deployment to Github Pages issue: Cannot match any routes

See original GitHub issue

Versions

Angular CLI: 1.5.5
Node: 8.9.4
OS: win32 x64
Angular: 5.0.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.5.5
@angular-devkit/build-optimizer: 0.0.34
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.38
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.5
@schematics/angular: 0.1.8
typescript: 2.4.2
webpack: 3.8.1

Error: Uncaught (in promise): Error: Cannot match any routes

I’m trying to deploy my Angular SPA app to github pages using this [/angular-cli/wiki](https://github.com/angular/angular-cli/wiki/stories-github-pages .)

I run this command ng build --prod --output-path docs --base-href learningangular

it reroutes my app from https://alamgirqazi.github.io/learningangular to https://alamgirqazi.github.io/learningangular/learningangular/

and I get the above error. I’ve added more detail here https://stackoverflow.com/questions/48436223/angular-cli-deploy-to-github-pages-issue-error-error-uncaught-in-promise-er#

Here’s the link to the app: https://alamgirqazi.github.io/learningangular

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
penghuilicommented, Apr 23, 2018

It’s better to change the documentation(https://github.com/angular/angular-cli/wiki/stories-github-pages), from

ng build --prod --output-path docs --base-href PROJECT_NAME

to

ng build --prod --output-path docs --base-href /PROJECT_NAME/
3reactions
denisyilmazcommented, Feb 22, 2018

in my case it works with leading/trailing slash in the base-href

ng build --prod --output-path docs --base-href /PROJECT_NAME/

<base href="/PROJECT_NAME/">
Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular CLI Deploy to Github Pages issue: ERROR Error ...
Angular CLI Deploy to Github Pages issue: ERROR Error: Uncaught (in promise): Error: Cannot match any routes · Subscribe to RSS.
Read more >
Using React Router on GitHub Pages - Medium
A guide to making sure your routes work once deployed and support direct URL navigation and a hard refresh. This guide assumes an...
Read more >
Deploying to Github Pages? Don't Forget to Fix Your Links
Is your site not working after deploying to Github Pages? Learn the #1 reason why deployments to Github Pages fail and how to...
Read more >
Problem with react-router app and Github Pages (Solved !)
The solution is to change our path of the route in our app: import './App.css'; import {BrowserRouter as Router,Switch,Route} from 'react-router ...
Read more >
Working with routes for HTTP APIs - Amazon API Gateway
The $default route. If no routes match a request, API Gateway returns {"message":"Not Found"} to the ...
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