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

Command ["foreman start -f Procfile.dev"] failed #11745

Closed
0xC000005 opened this issue Dec 4, 2020 · 11 comments
Closed

Command ["foreman start -f Procfile.dev"] failed #11745

0xC000005 opened this issue Dec 4, 2020 · 11 comments
Labels
area: developer experience bug always open for contribution

Comments

@0xC000005
Copy link

Describe the bug
Hi, I just finished setting up my forem, and the first time I run the bin/startup, the program errors and then quits.

To Reproduce

I finished bin/setup without any error, then the error occurs when I run bin/startup for the first time.

This is the output:

root@yuegaoya:~/forem# bin/startup
== STARTING UP ==
16:15:44 web.1       | started with pid 20249
16:15:44 webpacker.1 | started with pid 20250
16:15:44 sidekiq.1   | started with pid 20251
00h00m00s 0/0: : 16:15:45 webpacker.1 | ERROR: [Errno 21] Is a directory: 'bin'
16:15:45 webpacker.1 | CRITICAL:root:Traceback (most recent call last):
16:15:45 webpacker.1 |   File "/usr/lib/python2.7/dist-packages/cliapp/app.py", line 182, in _run
16:15:45 webpacker.1 |     self.settings.load_configs()
16:15:45 webpacker.1 |   File "/usr/lib/python2.7/dist-packages/cliapp/settings.py", line 829, in load_configs
16:15:45 webpacker.1 |     self._read_ini(pathname, f)
16:15:45 webpacker.1 |   File "/usr/lib/python2.7/dist-packages/cliapp/settings.py", line 838, in _read_ini
16:15:45 webpacker.1 |     cp.readfp(f)
16:15:45 webpacker.1 |   File "/usr/lib/python2.7/ConfigParser.py", line 324, in readfp
16:15:45 webpacker.1 |     self._read(fp, filename)
16:15:45 webpacker.1 |   File "/usr/lib/python2.7/ConfigParser.py", line 512, in _read
16:15:45 webpacker.1 |     raise MissingSectionHeaderError(fpname, lineno, line)
16:15:45 webpacker.1 | MissingSectionHeaderError: File contains no section headers.
16:15:45 webpacker.1 | file: /root/forem/config/webpack/development.js, line: 1
16:15:45 webpacker.1 | '/* eslint-env node */\n'
16:15:45 webpacker.1 |
16:15:45 webpacker.1 | Traceback (most recent call last):
16:15:45 webpacker.1 |   File "/usr/lib/python2.7/dist-packages/cliapp/app.py", line 182, in _run
16:15:45 webpacker.1 |     self.settings.load_configs()
16:15:45 webpacker.1 |   File "/usr/lib/python2.7/dist-packages/cliapp/settings.py", line 829, in load_configs
16:15:45 webpacker.1 |     self._read_ini(pathname, f)
16:15:45 webpacker.1 |   File "/usr/lib/python2.7/dist-packages/cliapp/settings.py", line 838, in _read_ini
16:15:45 webpacker.1 |     cp.readfp(f)
16:15:45 webpacker.1 |   File "/usr/lib/python2.7/ConfigParser.py", line 324, in readfp
16:15:45 webpacker.1 |     self._read(fp, filename)
16:15:45 webpacker.1 |   File "/usr/lib/python2.7/ConfigParser.py", line 512, in _read
16:15:45 webpacker.1 |     raise MissingSectionHeaderError(fpname, lineno, line)
16:15:45 webpacker.1 | MissingSectionHeaderError: File contains no section headers.
16:15:45 webpacker.1 | file: /root/forem/config/webpack/development.js, line: 1
16:15:45 webpacker.1 | '/* eslint-env node */\n'
16:15:46 webpacker.1 | exited with code 1
16:15:46 system      | sending SIGTERM to all processes
16:15:46 web.1       | terminated by SIGTERM
16:15:46 sidekiq.1   | terminated by SIGTERM
== Command ["foreman start -f Procfile.dev"] failed ==

Desktop (please complete the following information):

  • OS, version:
  • Browser, version:

Smartphone (please complete the following information):

  • Device: Vultr Server
  • OS, version: Ubuntu 18.04
@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2020

Thanks for the issue! We'll take your request into consideration and follow up if we decide to tackle this issue.

To our amazing contributors: issues labeled type: bug are always up for grabs, but for feature requests, please wait until we add a ready for dev before starting to work on it.

To claim an issue to work on, please leave a comment. If you've claimed the issue and need help, please ping @forem/oss and we will follow up within 3 business days.

For full info on how to contribute, please check out our contributors guide.

@rhymes
Copy link
Contributor

rhymes commented Dec 4, 2020

Hi @0xC000005, that's indeed an odd error and one I've never seen. It seems related to Python 2.7, which we definitely don't use directly so it makes me think there's something else going on.

I googled it with MissingSectionHeaderError and it seems related to some configuration file missing, which is even more odd since development.js is JavaScript file.

I wonder if it has anything to do with Node, which versions do you have installed?

The only thing related to this I can think of is node-sass (a dependency of webpacker) which depends on node-gyp which uses Python.

That might be what's going on there. Are you inside a virtual env? Can you try to install Python 3 globally, remove your node_modules directory and run yarn install --dev again?

@rhymes rhymes added area: developer experience bug always open for contribution labels Dec 4, 2020
@0xC000005
Copy link
Author

@rhymes No, I'm no inside a virtual environment. I directly installed forem to my ubuntu 18.04 server.
In terms of node installed, I used nvm to install nodejs 14.14.0, as node -v gives me the right version.
Both python -V and python3 -V give me the correct version so I guess the python3 is installed globally.

I deleted my node_modules folder under ~/.nvm/versions/node/v14.14.0/lib. Howevr, I can't run yarn install --dev.

That's what I got if I run yarn install --dev:
image

@rhymes
Copy link
Contributor

rhymes commented Dec 4, 2020

Regarding Python: according to the logs, node is using Python 2.x, my suggestion to use Python 3 to rebuild node_modules with that.

Which version of yarn do you have?

forem git:(master) yarn install --dev
yarn install v1.22.5
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
success Already up-to-date.
✨  Done in 0.95s.

we require >= 1.21.x

"yarn": ">=1.21.x",

@0xC000005
Copy link
Author

I FIGURED OUT.
So at all ubuntu 18.04, sudo apt-get install yarn or use the official guide resulting in installing cmdtest instead of yarn.
Referring to this question from yarn official: yarnpkg/yarn#2821

I fix my problem with the following commands:

sudo apt remove cmdtest
sudo apt remove yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install yarn

After that, yarn version gives me the correct version and I was able to run yarn install --dev without any error, and I was able to run bin/startup as well.

@rhymes Thank you so much for the help!!!!

@rhymes
Copy link
Contributor

rhymes commented Dec 4, 2020

@0xC000005 glad to have been of help! Thanks to you I discovered we actually have a transitive dependency on Python through Node in development :D

@junior563916
Copy link

@0xC000005's remove cmdtest works!

but there is new error,

== STARTING UP ==
20:48:37 web.1 | started with pid 16968
20:48:37 webpacker.1 | started with pid 16969
20:48:37 sidekiq.1 | started with pid 16970
20:48:42 webpacker.1 | yarn run v1.22.5
20:48:42 webpacker.1 | error Command "webpack-dev-server" not found.
20:48:42 webpacker.1 | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
20:48:43 web.1 | => Booting Puma
20:48:43 web.1 | => Rails 6.0.3.4 application starting in development
20:48:43 web.1 | => Run rails server --help for more startup options
20:48:43 webpacker.1 | exited with code 1
20:48:43 system | sending SIGTERM to all processes
20:48:43 web.1 | Exiting
20:48:43 web.1 | terminated by SIGTERM
20:48:44 sidekiq.1 | terminated by SIGTERM
== Command ["foreman start -f Procfile.dev"] failed ==

@rhymes
Copy link
Contributor

rhymes commented Dec 6, 2020

@junior563916 looks like you haven't installed all the dependencies, run yarn install --dev and bin/setup

@jmau111
Copy link
Contributor

jmau111 commented Mar 25, 2021

For anyone that gets this error in 2021, with a vm or something else, you likely have the wrong version of yarn (cmdtest).

yarn --version might work but not yarn -v .

If you get an error with yarn -v, such as "there is no scenario...", you can try that:

sudo apt remove cmdtest
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install yarn
yarn install --dev

Then bin/startup should work.

@xiaohuoni
Copy link

xiaohuoni commented Apr 22, 2021

Mac OS
node: 14.16.1
yarn: 1.22.5
Python :2.7.15

bin/startup
== STARTING UP ==
18:05:50 web.1       | started with pid 83485
18:05:50 webpacker.1 | started with pid 83486
18:05:50 sidekiq.1   | started with pid 83487
18:05:52 sidekiq.1   | 2021-04-22T10:05:52.594Z pid=83487 tid=1yd7 WARN: ArgumentError: invalid value for Integer(): "5 # Specifies the number of Puma threads"
18:05:52 sidekiq.1   | 2021-04-22T10:05:52.594Z pid=83487 tid=1yd7 WARN: /Users/xiaohuoni/.rvm/gems/ruby-2.7.2/gems/sidekiq-6.2.1/lib/sidekiq/cli.rb:246:in `Integer'
18:05:52 sidekiq.1   | /Users/xiaohuoni/.rvm/gems/ruby-2.7.2/gems/sidekiq-6.2.1/lib/sidekiq/cli.rb:246:in `setup_options'
18:05:52 sidekiq.1   | /Users/xiaohuoni/.rvm/gems/ruby-2.7.2/gems/sidekiq-6.2.1/lib/sidekiq/cli.rb:24:in `parse'
18:05:52 sidekiq.1   | /Users/xiaohuoni/.rvm/gems/ruby-2.7.2/gems/sidekiq-6.2.1/bin/sidekiq:27:in `<top (required)>'
18:05:52 sidekiq.1   | /Users/xiaohuoni/.rvm/gems/ruby-2.7.2/bin/sidekiq:23:in `load'
18:05:52 sidekiq.1   | /Users/xiaohuoni/.rvm/gems/ruby-2.7.2/bin/sidekiq:23:in `<top (required)>'
18:05:52 sidekiq.1   | /Users/xiaohuoni/.rvm/gems/ruby-2.7.2/gems/bundler-2.2.15/lib/bundler/cli/exec.rb:63:in `load'
18:05:52 sidekiq.1   | /Users/xiaohuoni/.rvm/gems/ruby-2.7.2/gems/bundler-2.2.15/lib/bundler/cli/exec.rb:63:in `kernel_load'
18:05:52 sidekiq.1   | /Users/xiaohuoni/.rvm/gems/ruby-2.7.2/gems/bundler-2.2.15/lib/bundler/cli/exec.rb:28:in `run'
18:05:52 sidekiq.1   | /Users/xiaohuoni/.rvm/gems/ruby-2.7.2/gems/bundler-2.2.15/lib/bundler/cli.rb:494:in `exec'
18:05:52 sidekiq.1   | /Users/xiaohuoni/.rvm/gems/ruby-2.7.2/gems/bundler-2.2.15/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
18:05:52 sidekiq.1   | /Users/xiaohuoni/.rvm/gems/ruby-2.7.2/gems/bundler-2.2.15/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
18:05:52 sidekiq.1   | /Users/xiaohuoni/.rvm/gems/ruby-2.7.2/gems/bundler-2.2.15/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
18:05:52 sidekiq.1   | /Users/xiaohuoni/.rvm/gems/ruby-2.7.2/gems/bundler-2.2.15/lib/bundler/cli.rb:30:in `dispatch'
18:05:52 sidekiq.1   | /Users/xiaohuoni/.rvm/gems/ruby-2.7.2/gems/bundler-2.2.15/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
18:05:52 sidekiq.1   | /Users/xiaohuoni/.rvm/gems/ruby-2.7.2/gems/bundler-2.2.15/lib/bundler/cli.rb:24:in `start'
18:05:52 sidekiq.1   | /Users/xiaohuoni/.rvm/gems/ruby-2.7.2/gems/bundler-2.2.15/exe/bundle:49:in `block in <top (required)>'
18:05:52 sidekiq.1   | /Users/xiaohuoni/.rvm/gems/ruby-2.7.2/gems/bundler-2.2.15/lib/bundler/friendly_errors.rb:130:in `with_friendly_errors'
18:05:52 sidekiq.1   | /Users/xiaohuoni/.rvm/gems/ruby-2.7.2/gems/bundler-2.2.15/exe/bundle:37:in `<top (required)>'
18:05:52 sidekiq.1   | /Users/xiaohuoni/.rvm/gems/ruby-2.7.2/bin/bundle:23:in `load'
18:05:52 sidekiq.1   | /Users/xiaohuoni/.rvm/gems/ruby-2.7.2/bin/bundle:23:in `<main>'
18:05:52 sidekiq.1   | exited with code 1
18:05:52 system      | sending SIGTERM to all processes
18:05:52 webpacker.1 | terminated by SIGTERM
18:05:53 web.1       | terminated by SIGTERM

== Command ["foreman start -f Procfile.dev"] failed ==

@rhymes
Copy link
Contributor

rhymes commented Apr 22, 2021

Hi @xiaohuoni, it probably has something to do with the RAILS_MAX_THREADS environment variable.

It looks like you have a line in .env set to:

export RAILS_MAX_THREADS = "5 # Specifies the number of Puma threads"

instead of

export RAILS_MAX_THREADS = 5 # Specifies the number of Puma threads

I was able to reproduce it with the first example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: developer experience bug always open for contribution
Projects
None yet
Development

No branches or pull requests

5 participants