Closed lacek closed 5 years ago
I can't reproduce it on my side. Do you have any details on how to reproduce it?
I am on macOS 10.14.5. Below are steps to reproduce the error:
node --version
# v12.1.0
npx --version
# 6.9.0
npx create-openapi-repo openapi
# Welcome to the OpenAPI-Repo generator!
# ? Do you already have OpenAPI/Swagger spec for your API? No
# ? Select OpenAPI version: OpenAPI 3
# ? API Name: openapi
# ? Split spec into separate files: paths/*, definitions/* [Experimental]? No
# ? Prepare manual code samples folder? No
# ? Install SwaggerUI? Yes
# ? Set up Travis CI? No
cd openapi
npm start
# visit http://localhost:8080, ReDoc UI is normal
# visit http://localhost:8080/swagger-editor, page is empty, error is shown in developer console
# Ctrl-C
# "Redocly config not found at redocly.yaml. Using empty..." was shown, so let's try fix it:
mv .redoclyrc redocly.yaml
npm start
# same result
I've got another Linux server with Docker, so I tried another set of steps to reproduce the same error within a Ubuntu container:
# port 8080 was occupied on the server, so forwards to port 3000
docker run -it --rm -p 3000:8080 ubuntu:18.04 bash
# we are not in container as root
apt-get update
apt-get install -y nodejs npm
node --version
# v8.10.0
npm --version
# 3.5.2
npm install --allow-root -g create-openapi-repo
create-openapi-repo openapi
# Welcome to the OpenAPI-Repo generator!
# ? Do you already have OpenAPI/Swagger spec for your API? No
# ? Select OpenAPI version: OpenAPI 3
# ? API Name: openapi
# ? Split spec into separate files: paths/*, definitions/* [Experimental]? No
# ? Prepare manual code samples folder? No
# ? Install SwaggerUI? Yes
# ? Set up Travis CI? No
cd openapi
npm start
# visit http://linux-server:3000/swagger-editor, page is empty, same error in console
# Ctrl-C
mv .redoclyrc redocly.yaml
npm start
# visit http://linux-server:3000/swagger-editor, page is empty, same error in console
I just followed the steps you provided and everything works fine for me on Mac. Could you try again using the latest version?
Thanks @RomanHotsiy, it works on Mac now.
On the other hand, I have also tried on a Ubuntu 18.04 vagrant VM and problem still occurs.
On terminal 1:
vagrant@ubuntu:~$ sudo apt-get install -y nodejs npm
...
vagrant@ubuntu:~$ npm --version
3.5.2
vagrant@ubuntu:~$ node --version
v8.10.0
vagrant@ubuntu:~$ sudo npm install -g create-openapi-repo
vagrant@ubuntu:~$ create-openapi-repo openapi
Welcome to the OpenAPI-Repo generator!
? Do you already have OpenAPI/Swagger spec for your API? No
? Select OpenAPI version: OpenAPI 3
? API Name: openapi
? Split spec into separate files: paths/*, definitions/* [Experimental]? No
? Prepare manual code samples folder? No
? Install SwaggerUI? Yes
? Set up Travis CI? No
vagrant@ubuntu:~$ cd openapi
vagrant@ubuntu:~/openapi$ npm start
> openapi@1.0.0 start /home/vagrant/openapi
> swagger-repo serve
Development server started � :
✔ Documentation (ReDoc): http://localhost:8080
✔ Documentation (SwaggerUI): http://localhost:8080/swagger-ui/
✔ Swagger Editor: http://localhost:8080/swagger-editor/
Watching changes...
In Chrome, http://localhost:8080/swagger-ui/
is still empty with the same error in conosle.
On terminal 2
vagrant@ubuntu:~$ curl http://localhost:8080/swagger-editor.css
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /swagger-editor.css</pre>
</body>
</html>
You may close the issue if you are not intended to investigate further on Ubuntu. I was testing on Ubuntu only to see if it's problem of setup on my Mac.
Thanks @RomanHotsiy, it works on Mac now.
On the other hand, I have also tried on a Ubuntu 18.04 vagrant VM and problem still occurs.
On terminal 1:
vagrant@ubuntu:~$ sudo apt-get install -y nodejs npm ... vagrant@ubuntu:~$ npm --version 3.5.2 vagrant@ubuntu:~$ node --version v8.10.0 vagrant@ubuntu:~$ sudo npm install -g create-openapi-repo vagrant@ubuntu:~$ create-openapi-repo openapi Welcome to the OpenAPI-Repo generator! ? Do you already have OpenAPI/Swagger spec for your API? No ? Select OpenAPI version: OpenAPI 3 ? API Name: openapi ? Split spec into separate files: paths/*, definitions/* [Experimental]? No ? Prepare manual code samples folder? No ? Install SwaggerUI? Yes ? Set up Travis CI? No vagrant@ubuntu:~$ cd openapi vagrant@ubuntu:~/openapi$ npm start > openapi@1.0.0 start /home/vagrant/openapi > swagger-repo serve Development server started � : ✔ Documentation (ReDoc): http://localhost:8080 ✔ Documentation (SwaggerUI): http://localhost:8080/swagger-ui/ ✔ Swagger Editor: http://localhost:8080/swagger-editor/ Watching changes...
In Chrome,
http://localhost:8080/swagger-ui/
is still empty with the same error in conosle.On terminal 2
vagrant@ubuntu:~$ curl http://localhost:8080/swagger-editor.css <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Error</title> </head> <body> <pre>Cannot GET /swagger-editor.css</pre> </body> </html>
You may close the issue if you are not intended to investigate further on Ubuntu. I was testing on Ubuntu only to see if it's problem of setup on my Mac.
Strange. It doesn't work on Mac again. Here's what I did:
npm start
on Mac and visit /swagger-editor
again: failedopenapi
folder and redo all the steps, still failedI am sure I did no change to the openapi
folder on my Mac between step 2-5. Not sure what triggers the problem.
It looks like there is something on your side. I would appreciate if you could investigate further.
Thanks!
Finally got it. I got an empty page with error because I visited the URL http://localhost:8080/swagger-editor
. By adding a trailing slash, everything works fine regardless of the environment (Mac/Linux/Linux in Docker).
It worked once and just once before because I copied and pasted the URL instead of typing by hand. This is so embarrassing. 😂
Error is shown in console when browsing /swagger-editor:
It appears that some of the files are not being served and MIME type of css file is incorrect.