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

跨域了,这么办呢 #75

Open
zzh3319 opened this issue Dec 17, 2020 · 2 comments
Open

跨域了,这么办呢 #75

zzh3319 opened this issue Dec 17, 2020 · 2 comments

Comments

@zzh3319
Copy link

zzh3319 commented Dec 17, 2020

(index):1 Access to script at 'http://localhost:8080/js/app.js' from origin 'http://localhost:5000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
system.min.js:4 GET http://localhost:8080/js/app.js net::ERR_FAILED
(anonymous) @ system.min.js:4
g.instantiate @ system.min.js:4
t.instantiate @ system.min.js:4
t.instantiate @ named-register.min.js:1
(anonymous) @ system.min.js:4
Promise.then (async)
t @ system.min.js:4
(anonymous) @ system.min.js:4
Promise.then (async)
g.import @ system.min.js:4
e.import @ system.min.js:4
t.import @ use-default.min.js:1
(anonymous) @ (index):42
(anonymous) @ single-spa.min.js:1
Promise.then (async)
(anonymous) @ single-spa.min.js:1
Promise.then (async)
tt @ single-spa.min.js:1
(anonymous) @ single-spa.min.js:1
Promise.then (async)
Ct @ single-spa.min.js:1
Tt @ single-spa.min.js:1
(anonymous) @ (index):40
Promise.then (async)
(anonymous) @ (index):33
(anonymous) @ (index):60
single-spa.min.js:1 Uncaught navbar: Application 'navbar' died in status LOADING_SOURCE_CODE: Error loading http://localhost:8080/js/app.js
at HTMLScriptElement. (https://cdnjs.cloudflare.com/ajax/libs/systemjs/6.1.1/system.min.js:4:5825)

@joeldenning
Copy link
Owner

I cloned the repo and did a fresh install and was unable to reproduce this issue.

image

My guess is that you have a different server running on port 8080 already, before you ran npm run serve in the navbar. You should find any servers on port 8080 and stop them. Then run npm run serve in the navbar. On linux/osx, you can do this:

lsof -i :8080
kill <pid>

cd coexisting-vue-microfrontends/navbar
npm run serve

@zhongs
Copy link

zhongs commented May 29, 2021

@@@开发依赖安装了这个插件,解决了你描述的跨域问题 @zzh3319

"vue-cli-plugin-single-spa": "^1.0.1"

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

3 participants