Discourse Installation Help

Hello everyone,

Just wanted to let you all know that past office hours have been just troubleshooting Discourse installation problems and helping some of our participants successfully run the Discourse locally. So, there are no recordings available of those sessions.

If you are still encountering issues with Discourse installation and unable to run it locally, please let us know. You can even post your problems here and we can work on them together. You don’t have to wait until the office hours session to bring up the issues. Please free feel to ask questions anytime.

Thanks,

Bijay

2 Likes

Hello! Discourse was running fine a couple of days ago, but now when i do bundle exec rails server, it first tells me:

Could not find openssl-2.2.0 in any of the sources
Run `bundle install` to install missing gems.

and then when i run bundle install, it gives me this error. Has anyone run into this before and know how to solve it? i already tried deleting Gemfile.lock and bundle installing again, but I got the same error.

I’ve tried doing the command in red, and it runs successfully, but then, when I do bundle install again, I get the same error. Does anyone have any advice? I’m running this on a Mac.

Are you sure you are in your Discourse home folder? (likely ~/discourse), you can check with the command pwd. Sometimes these could not find errors occur when you are inside a sub-folder and trying to run the server.

Yes, I ran bundle exec rails server after I changed directories into the discourse folder.

Could you try:

  1. Pulling the latest Discourse code
git pull
  1. Migrating the Database
./bin/rake db:migrate
  1. Running the server
bin/rails s

If you still get an error, could you copy and paste the entire stack trace in a message here?

When running the second command, I get this error:

Could not find openssl-2.2.0 in any of the sources
Run `bundle install` to install missing gems.

And I tried to bundle install again, but it gave me the same error as before:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/Users/nanarboursalian/discourse/vendor/cache/ruby/2.6.0/gems/openssl-2.2.0/ext/openssl
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r
./siteconf20210623-81133-1vij1ff.rb extconf.rb
checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
checking for openssl/ssl.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)
	--with-openssl-dir
	--with-openssl-include
	--without-openssl-include=${openssl-dir}/include
	--with-openssl-lib
	--without-openssl-lib=${openssl-dir}/lib
	--with-kerberos-dir
	--without-kerberos-dir
	--with-kerberos-include
	--without-kerberos-include=${kerberos-dir}/include
	--with-kerberos-lib
	--without-kerberos-lib=${kerberos-dir}/lib
	--with-debug
	--without-debug
	--enable-debug
	--disable-debug
	--with-nsllib
	--without-nsllib
	--with-socketlib
	--without-socketlib
	--with-openssl-config
	--without-openssl-config
	--with-pkg-config
	--without-pkg-config
extconf.rb:99:in `<main>': OpenSSL library could not be found. You might want to
use --with-openssl-dir=<dir> option to specify the prefix where OpenSSL is
installed. (RuntimeError)

To see why this extension failed to compile, please check the mkmf.log which can
be found here:

/Users/nanarboursalian/discourse/vendor/cache/ruby/2.6.0/extensions/universal-darwin-20/2.6.0/openssl-2.2.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
/Users/nanarboursalian/discourse/vendor/cache/ruby/2.6.0/gems/openssl-2.2.0 for
inspection.
Results logged to
/Users/nanarboursalian/discourse/vendor/cache/ruby/2.6.0/extensions/universal-darwin-20/2.6.0/openssl-2.2.0/gem_make.out

An error occurred while installing openssl (2.2.0), and Bundler cannot
continue.
Make sure that `gem install openssl -v '2.2.0' --source 'https://rubygems.org/'`
succeeds before bundling.

In Gemfile:
  cose was resolved to 1.2.0, which depends on
    openssl-signature_algorithm was resolved to 1.1.1, which depends on
      openssl


Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/Users/nanarboursalian/discourse/vendor/cache/ruby/2.6.0/gems/nokogumbo-2.0.5/ext/nokogumbo
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r
./siteconf20210623-81133-1lm2nqk.rb extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in
`require': cannot load such file -- nokogiri/nokogiri (LoadError)
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in
`require'
from
/Users/nanarboursalian/discourse/vendor/cache/ruby/2.6.0/gems/nokogiri-1.11.7-arm64-darwin/lib/nokogiri/extension.rb:25:in
`rescue in <top (required)>'
from
/Users/nanarboursalian/discourse/vendor/cache/ruby/2.6.0/gems/nokogiri-1.11.7-arm64-darwin/lib/nokogiri/extension.rb:4:in
`<top (required)>'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in
`require'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in
`require'
from
/Users/nanarboursalian/discourse/vendor/cache/ruby/2.6.0/gems/nokogiri-1.11.7-arm64-darwin/lib/nokogiri.rb:11:in
`<top (required)>'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in
`require'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in
`rescue in require'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:34:in
`require'
	from extconf.rb:4:in `<main>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in
`require':
dlopen(/Users/nanarboursalian/discourse/vendor/cache/ruby/2.6.0/gems/nokogiri-1.11.7-arm64-darwin/lib/nokogiri/2.6/nokogiri.bundle,
0x0009): could not use
'/Users/nanarboursalian/discourse/vendor/cache/ruby/2.6.0/gems/nokogiri-1.11.7-arm64-darwin/lib/nokogiri/2.6/nokogiri.bundle'
because it is not a compatible arch -
/Users/nanarboursalian/discourse/vendor/cache/ruby/2.6.0/gems/nokogiri-1.11.7-arm64-darwin/lib/nokogiri/2.6/nokogiri.bundle
(LoadError)
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in
`require'
from
/Users/nanarboursalian/discourse/vendor/cache/ruby/2.6.0/gems/nokogiri-1.11.7-arm64-darwin/lib/nokogiri/extension.rb:6:in
`<top (required)>'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in
`require'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in
`require'
from
/Users/nanarboursalian/discourse/vendor/cache/ruby/2.6.0/gems/nokogiri-1.11.7-arm64-darwin/lib/nokogiri.rb:11:in
`<top (required)>'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in
`require'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in
`rescue in require'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:34:in
`require'
	from extconf.rb:4:in `<main>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in
`require': cannot load such file -- nokogiri (LoadError)
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in
`require'
	from extconf.rb:4:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in
/Users/nanarboursalian/discourse/vendor/cache/ruby/2.6.0/gems/nokogumbo-2.0.5
for inspection.
Results logged to
/Users/nanarboursalian/discourse/vendor/cache/ruby/2.6.0/extensions/universal-darwin-20/2.6.0/nokogumbo-2.0.5/gem_make.out

An error occurred while installing nokogumbo (2.0.5), and Bundler
cannot continue.
Make sure that `gem install nokogumbo -v '2.0.5' --source
'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  sanitize was resolved to 5.2.3, which depends on
    nokogumbo
1 Like

Hmm, let’s try starting fresh. Could you try the following steps:

  1. Backup any theme component/plugins you’ve created (i.e. push it to a GitHub repository so you can clone it again later)

  2. Drop the database:

./bin/rake db:drop
  1. Delete your Discourse folder and remove it from the trash.
  2. Follow the Beginner’s Guide to Install Discourse once again. Including running the script to install dependencies (it should skip anything you already have installed)

Hopefully when running the script it should install the dependencies correctly… I think this should resolve the issue, but if it doesn’t, could you visit either my office hours (2021-06-24T19:00:00Z) or @bmaharjan 's office hours (2021-06-26T18:00:00Z)?

Also, what version macOS are you on? Do you have an M1 Chip or Intel? And did you install any dependencies for any other non-discourse related projects before this issue occurred?

When I ran this in discourse terminal, I got the same error as before.

I’ve got macOS Big Sur 11.4. The only thing that I could think of that has changed between when discourse worked and now is that I believe xcode select tools was updated. I also globally installed ember-cli and sass. I also have an Intel chip.

:point_up: I think the issue resulted from this…

Could you try re-running the script:

bash <(curl -s https://raw.githubusercontent.com/techAPJ/install-rails/master/mac)

Oo yes! I’ve been trying to rerun that all afternoon lol. The script dies after the default ruby version is set. It says I have a Gem File Permissions error (although I didn’t get that the first time), so I tried running sudo gem update --system instead, and it gave me this error:

Installing RubyGems 3.2.21
ERROR:  While executing gem ... (Errno::EPERM)
    Operation not permitted @ rb_sysopen - /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/gem

I’m a little confused, since I didn’t change anything with gems.

Be careful running sudo with installing anything related to ruby. Ruby is pre-installed on MacOS comes with Ruby installed (which I believe it needs for certain system things). The system Ruby is usually older, and although you can use it for some things, you shouldn’t be altering it (upading/adding gems) or using it for development. Which is why for Discourse and other ruby development we use things like rbenv which allows us to install and use other versions of Ruby for development.

My guess is that something changed resulting in rbenv not being used and system ruby is trying to be used. But I may be wrong… I’m not sure if this will work, but maybe could you try doing the install in a new user? Or if you have a time-machine backup, try backing up to the previous point where it was working?

Before you do that though, perhaps verify if you have rbenv installed and are using it. (This is installed with that Discourse script but maybe its not enabled? See: Install Ruby on macOS with Rbenv)

@bmaharjan Any thoughts on this issue? Do you know what the cause of this may be?

When I get to the command that links openssl, I get the following error:

Warning: Refusing to link macOS provided/shadowed software: openssl@1.1
If you need to have openssl@1.1 first in your PATH, run:
  echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> /Users/nanarboursalian/.bash_profile

For compilers to find openssl@1.1 you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

For pkg-config to find openssl@1.1 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"

I tried running the echo command and then doing source .bash_profile, but when I ran the script again, I got the same error.

Hi @nanar.boursalian ,

I believe I had the same error, but I guess it was solved when I followed these steps.

sudo apt-get install ruby-dev zlib1g-dev libgmp-dev libxml2-dev libssl-dev openssl

Can you try that command and let us know the output?

It will not let me run the command because it says it does not recognize apt-get. I tried replacing sudo apt-get with brew, but then I got this error after it ran:

Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/services).
==> Updated Formulae
Updated 63 formulae.

==> Tapping homebrew/cask
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask'...
remote: Enumerating objects: 578803, done.
remote: Counting objects: 100% (61/61), done.
remote: Compressing objects: 100% (48/48), done.
remote: Total 578803 (delta 31), reused 38 (delta 13), pack-reused 578742
Receiving objects: 100% (578803/578803), 253.94 MiB | 31.77 MiB/s, done.
Resolving deltas: 100% (408765/408765), done.
Tapped 3931 casks (4,010 files, 272.5MB).
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
Error: No available formula or cask with the name "ruby-dev".
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.

After that, I tried running the bash script again, but it told me that I have 7 outdated formulae, so I did brew upgrade and tried running the script again, but the terminal told me again that it refuses to link openssl when it gets to that part in the script.

Hi @nanar.boursalian

I think Keegan is right. Have you tried running rvm commands to install ruby and openssl?

See if this helps:

Hello,

I’m having a problem with Discourse Installation. I’ve followed the steps in the Google Doc titled “Documentation installing Discourse”

However, I get an error in the last step, bundle exec rails server and can’t access http://localhost:3000/

I kept repeating the same steps over and over but get the same error like

Now, I just want to delete all the installations I did in the past and start from the very beginning again as if I never tried to install something to the local machine.

Do you know any other way to delete all the previous installations I made and then start it again?

1 Like

Take a look at the section “:sponge: You need to wipe all your data and start fresh with your Discourse installation” here:

This should delete the existing Discourse database, pull in the latest code and migrate the new data.

However, if this doesn’t work, try doing the following:

In your Discourse folder,

./bin/rake db:drop

Delete your Discourse folder and continue following the install guide from here:

Hello,

I tried to follow the steps you provided, but either way doesn’t work. I get messages saying,

yunsohuiui-MacBookAir:discourse sohee$ ./bin/rake db:drop db:create db:migrate
Could not find rake-13.0.3 in any of the sources
Run `bundle install` to install missing gems.

yunsohuiui-MacBookAir:discourse sohee$ ./bin/rake db:drop
Could not find rake-13.0.3 in any of the sources
Run `bundle install` to install missing gems.

Could you book a 1-1 Office Hour Meeting for one of the time slots convenient for you? Reply to this topic in the recommended format: