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

Could not connect to the PostCSS server (RuntimeError) #29

Open
olakara opened this issue Jun 3, 2021 · 12 comments
Open

Could not connect to the PostCSS server (RuntimeError) #29

olakara opened this issue Jun 3, 2021 · 12 comments

Comments

@olakara
Copy link

olakara commented Jun 3, 2021

I am running jekyll with jekyll-process through docker compose:

version: '3.3'

services:
  jekyll:
    image: jekyll/jekyll:latest
    #    command: jekyll serve --watch --force_polling --verbose --trace
    command: jekyll serve --livereload --drafts --future --port 4000 --livereload_port 35729
    ports:
      - 4000:4000
    volumes:
      - .:/srv/jekyll
    environment:
      - JEKYLL_ROOTLESS=true

I keep getting error:

jekyll_1  | Configuration file: /srv/jekyll/_config.yml
jekyll_1  | jekyll 3.8.7 | Error:  Could not connect to the PostCSS server
jekyll_1  | /usr/gem/gems/jekyll-postcss-0.4.1/lib/jekyll-postcss/socket.rb:70:in `rescue in start_dev_server': Could not connect to the PostCSS server (RuntimeError)
jekyll_1  |     from /usr/gem/gems/jekyll-postcss-0.4.1/lib/jekyll-postcss/socket.rb:61:in `start_dev_server'
jekyll_1  |     from /usr/gem/gems/jekyll-postcss-0.4.1/lib/jekyll-postcss/socket.rb:13:in `initialize'
jekyll_1  |     from /usr/gem/gems/jekyll-postcss-0.4.1/lib/jekyll/converters/postcss.rb:15:in `new'
jekyll_1  |     from /usr/gem/gems/jekyll-postcss-0.4.1/lib/jekyll/converters/postcss.rb:15:in `block in initialize'
jekyll_1  |     from /usr/gem/gems/jekyll-postcss-0.4.1/lib/jekyll/converters/postcss.rb:15:in `fetch'
jekyll_1  |     from /usr/gem/gems/jekyll-postcss-0.4.1/lib/jekyll/converters/postcss.rb:15:in `initialize'
jekyll_1  |     from /usr/gem/gems/jekyll-3.8.7/lib/jekyll/site.rb:295:in `new'
jekyll_1  |     from /usr/gem/gems/jekyll-3.8.7/lib/jekyll/site.rb:295:in `block in instantiate_subclasses'
jekyll_1  |     from /usr/gem/gems/jekyll-3.8.7/lib/jekyll/site.rb:294:in `map'
jekyll_1  |     from /usr/gem/gems/jekyll-3.8.7/lib/jekyll/site.rb:294:in `instantiate_subclasses'
jekyll_1  |     from /usr/gem/gems/jekyll-3.8.7/lib/jekyll/site.rb:116:in `setup'
jekyll_1  |     from /usr/gem/gems/jekyll-3.8.7/lib/jekyll/site.rb:32:in `initialize'
jekyll_1  |     from /usr/gem/gems/jekyll-3.8.7/lib/jekyll/commands/build.rb:30:in `new'
jekyll_1  |     from /usr/gem/gems/jekyll-3.8.7/lib/jekyll/commands/build.rb:30:in `process'
jekyll_1  |     from /usr/gem/gems/jekyll-3.8.7/lib/jekyll/commands/serve.rb:93:in `block in start'
jekyll_1  |     from /usr/gem/gems/jekyll-3.8.7/lib/jekyll/commands/serve.rb:93:in `each'
jekyll_1  |     from /usr/gem/gems/jekyll-3.8.7/lib/jekyll/commands/serve.rb:93:in `start'
jekyll_1  |     from /usr/gem/gems/jekyll-3.8.7/lib/jekyll/commands/serve.rb:75:in `block (2 levels) in init_with_program'
jekyll_1  |     from /usr/gem/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
jekyll_1  |     from /usr/gem/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
jekyll_1  |     from /usr/gem/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
jekyll_1  |     from /usr/gem/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
jekyll_1  |     from /usr/gem/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
jekyll_1  |     from /usr/gem/gems/jekyll-3.8.7/exe/jekyll:15:in `<top (required)>'
jekyll_1  |     from /usr/local/bundle/bin/jekyll:29:in `load'
jekyll_1  |     from /usr/local/bundle/bin/jekyll:29:in `<main>'
jekyll_1  | /usr/gem/gems/jekyll-postcss-0.4.1/lib/jekyll-postcss/socket.rb:62:in `initialize': Address not available - connect(2) for "localhost" port 8124 (Errno::EADDRNOTAVAIL)
jekyll_1  |     from /usr/gem/gems/jekyll-postcss-0.4.1/lib/jekyll-postcss/socket.rb:62:in `open'
jekyll_1  |     from /usr/gem/gems/jekyll-postcss-0.4.1/lib/jekyll-postcss/socket.rb:62:in `start_dev_server'
jekyll_1  |     from /usr/gem/gems/jekyll-postcss-0.4.1/lib/jekyll-postcss/socket.rb:13:in `initialize'
jekyll_1  |     from /usr/gem/gems/jekyll-postcss-0.4.1/lib/jekyll/converters/postcss.rb:15:in `new'
jekyll_1  |     from /usr/gem/gems/jekyll-postcss-0.4.1/lib/jekyll/converters/postcss.rb:15:in `block in initialize'
jekyll_1  |     from /usr/gem/gems/jekyll-postcss-0.4.1/lib/jekyll/converters/postcss.rb:15:in `fetch'
jekyll_1  |     from /usr/gem/gems/jekyll-postcss-0.4.1/lib/jekyll/converters/postcss.rb:15:in `initialize'
jekyll_1  |     from /usr/gem/gems/jekyll-3.8.7/lib/jekyll/site.rb:295:in `new'
jekyll_1  |     from /usr/gem/gems/jekyll-3.8.7/lib/jekyll/site.rb:295:in `block in instantiate_subclasses'
jekyll_1  |     from /usr/gem/gems/jekyll-3.8.7/lib/jekyll/site.rb:294:in `map'
jekyll_1  |     from /usr/gem/gems/jekyll-3.8.7/lib/jekyll/site.rb:294:in `instantiate_subclasses'
jekyll_1  |     from /usr/gem/gems/jekyll-3.8.7/lib/jekyll/site.rb:116:in `setup'
jekyll_1  |     from /usr/gem/gems/jekyll-3.8.7/lib/jekyll/site.rb:32:in `initialize'
jekyll_1  |     from /usr/gem/gems/jekyll-3.8.7/lib/jekyll/commands/build.rb:30:in `new'
jekyll_1  |     from /usr/gem/gems/jekyll-3.8.7/lib/jekyll/commands/build.rb:30:in `process'
jekyll_1  |     from /usr/gem/gems/jekyll-3.8.7/lib/jekyll/commands/serve.rb:93:in `block in start'
jekyll_1  |     from /usr/gem/gems/jekyll-3.8.7/lib/jekyll/commands/serve.rb:93:in `each'
jekyll_1  |     from /usr/gem/gems/jekyll-3.8.7/lib/jekyll/commands/serve.rb:93:in `start'
jekyll_1  |     from /usr/gem/gems/jekyll-3.8.7/lib/jekyll/commands/serve.rb:75:in `block (2 levels) in init_with_program'
jekyll_1  |     from /usr/gem/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
jekyll_1  |     from /usr/gem/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
jekyll_1  |     from /usr/gem/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
jekyll_1  |     from /usr/gem/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
jekyll_1  |     from /usr/gem/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
jekyll_1  |     from /usr/gem/gems/jekyll-3.8.7/exe/jekyll:15:in `<top (required)>'
jekyll_1  |     from /usr/local/bundle/bin/jekyll:29:in `load'
jekyll_1  |     from /usr/local/bundle/bin/jekyll:29:in `<main>'

Any idea how to resolve this?

@mhanberg
Copy link
Owner

mhanberg commented Jun 3, 2021

You need node js to use post css. I assume that the Jekyll image does not include it.

@olakara
Copy link
Author

olakara commented Jun 5, 2021

@mhanberg thanks for your input.. I did following:
docker-compose run jekyll /bin/bash
and ran node --version
Looks like I have nodejs ..

image

@Atem18
Copy link
Contributor

Atem18 commented Jul 12, 2021

@olakara Please remove the env var JEKYLL_ROOTLESS and try again.

@rwgrier
Copy link

rwgrier commented Jul 15, 2021

I am seeing this same error when I attempt to deploy via Netlify. I feel like I'm doing something silly with my config.

Netlify Support Post:
https://answers.netlify.com/t/deploy-failing-jekyll-tailwind-css/41017

Github Branch with all of my attempts:
https://github.com/rwgrier/rwgrier.github.io/tree/tailwindcss

@Atem18
Copy link
Contributor

Atem18 commented Jul 16, 2021

@rwgrier there is a 404 on your link

@rwgrier
Copy link

rwgrier commented Jul 16, 2021

@Atem18 Sorry, I got kinda frustrated and gave up on it. I moved to a generated version of the Tailwind CSS file.

@Atem18
Copy link
Contributor

Atem18 commented Jul 20, 2021

@rwgrier No problem, if you ever want to see a working example, please see my website here : https://github.com/Atem18/atemlire

@olakara
Copy link
Author

olakara commented Jul 24, 2021

@Atem18 I cloned your repo https://github.com/Atem18/atemlire.git and tried to run .. and ended up with the same error:
image

all I did was run this command:
docker run --name=atemlire-dev --volume="C:/Users/Lenovo/source/atemlire/app:/srv/jekyll" -p 4000:4000 -it jekyll/jekyll:4.2.0 jekyll serve --drafts --incremental

@Atem18
Copy link
Contributor

Atem18 commented Jul 24, 2021

@olakara If you go upper, you will see the real error. It's probably because the node_modules are missing.

I pushed an update to my repo and the trick is to build your own image and override the ENTRYPOINT because for whatever reason, there is nodejs in the official Jekyll docker image but while it does install the Ruby Gems, it does not install the Node packages.

Do note that I did many tests with Docker Compose and there is always that error and I have no clue why it's not working with Docker Compose but it's working with Docker.

@tyHdev
Copy link

tyHdev commented Aug 1, 2021

I am observing the same behavior with a very similar docker-compose.yml file for my Jekyll project. I tried building a custom image based on Ruby:3.0.2 with nodejs and npm installed explicitly, and with port 8124 exposed (not sure whether this is needed) and when attempting to run a container based on that image with docker-compose, am observing the same behavior as well.

@guschiavon
Copy link

I get the same error running with the following docker-compose.yml file:

services:
  jekyll:
    image: jekyll/jekyll:latest
    command: jekyll s -l
    ports:
      - 4000:4000
    volumes:
      - .:/srv/jekyll

@codejanovic
Copy link

@olakara @guschiavon
I could fix it by specifing the jekyll environment variable:

environment:
      - JEKYLL_ENV=development jekyll build

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

7 participants