Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not able to run application using v3.0.0-beta.19 #70

Closed
HemTech opened this issue May 7, 2019 · 9 comments
Closed

not able to run application using v3.0.0-beta.19 #70

HemTech opened this issue May 7, 2019 · 9 comments
Assignees

Comments

@HemTech
Copy link

HemTech commented May 7, 2019

Hi, @joeldenning
I have implemented single-spa angular 7 solution and it was working till v3.0.0-beta.17 release. I show the updated version today and try to implement the lazy loading with the latest version but did not get any luck.
I have cloned the coexisting-angular-microfrontends solution on my local and follow the step under the local development section(https://github.com/joeldenning/coexisting-angular-microfrontends).

It is giving file not fond exception.

image

image

Am I missing anything?

@joeldenning
Copy link
Member

joeldenning commented May 7, 2019

Are you able to run one app at a time, as explained here?

I just deleted my local copy of the repo, re-cloned it, and followed the instructions and was able to get it working. What operating system are you on? I'm on Mac.

The 404 you're getting in the browser for the HTML file is the most interesting thing about this. The request to http://localhost:4200 should be hitting the root-html-file server, which should be giving you a 200 with the index.html file. One way that you could be getting a 404 would be if you ran ng serve in one of your terminals without specifying the correct ports. Did you run ng serve --port 4201 --publicHost http://localhost:4201 --disable-host-check (with the correct port per application), instead of ng serve? That is my best guess without other info.

@HemTech
Copy link
Author

HemTech commented May 7, 2019

Thank you joeldenning for your help!

I am use windows 10. I have updated new package package but got the same issue.
I have followed below steps.

  1. Clone the apps(https://github.com/joeldenning/coexisting-angular-microfrontends).
  2. First terminal tab

cd root-html-file
npm install
npm start
3. # Second terminal tab
cd app1
npm install
ng serve --port 4201 --publicHost http://localhost:4201 --disable-host-check
4. # Third terminal tab
cd app2
npm install
ng serve --port 4202 --publicHost http://localhost:4202 --disable-host-check
5. # Fourth terminal tab
cd navbar
npm install
ng serve --port 4203 --publicHost http://localhost:4203 --disable-host-check

try to access the site using - http://localhost:4200

Below are my terminal detail
image

@joeldenning
Copy link
Member

This might be windows specific, then, I've had issues in the past with the servers I'm using in root-html-file. Try the following, and let me know if any of them work:

  1. Change this line to not have the / before index.html. So it would be light-server -s . --historyindex 'index.html' -p 4200
  2. Instead of running npm start inside of root-html-file, try the following: npx http-server . -p 4200. This has the major disadvantage that if you navigate away from the / route in the browser and refresh the page that you'll get a 404. But if it works for you going straight to http://localhost:4200 then we'll know that this must be an issue with light-server

@joeldenning joeldenning self-assigned this May 7, 2019
@HemTech
Copy link
Author

HemTech commented May 7, 2019

Yes, you are right. These changes are working but getting 404 when refresh the page.

joeldenning added a commit to joeldenning/coexisting-angular-microfrontends that referenced this issue May 7, 2019
@joeldenning
Copy link
Member

Okay, so it's windows-specific, then. I just pushed a commit that hopefully resolves this issue. Can you verify it works for you?

@HemTech
Copy link
Author

HemTech commented May 7, 2019

Its working but not with page refresh(404).
image

@joeldenning
Copy link
Member

Damn, I'll have to look into this later. Need to find a static server that works in Windows and is able to do SPA routing and just always return the index.html file. Other windows users reported that light-server worked, but looks like not in all cases. I'll spend some time on this later.

@joeldenning
Copy link
Member

The issue with the serve package is reported here: vercel/serve#525.

I will be submitting a PR to serve to fix this

@joeldenning
Copy link
Member

joeldenning commented Jun 6, 2019

Just submitted vercel/serve-handler#89 which will fix serve to work in windows. In the meantime, I have downgraded coexisting-angular-microfrontends to 10.1.1, which works around the issue until that PR is merged.

Closing this since it's now working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants