# Common issues with environment

This article lists common issues that Marfeelers face, with their solution.

If you encounter a new problem/solution pair, you can update this document (opens new window).

Ask for help on the #env-support slack channel.

# Gutenberg won't start

If you locate the following output:

[WARNING] [talledLocalContainer] org.codehaus.cargo.container.ContainerException: Port number 8080 (defined with the property cargo.servlet.port) is in use. Please free it on the system or set it to a different port in the container configuration.
[ERROR] Starting container [org.codehaus.cargo.container.tomcat.Tomcat8xInstalledLocalContainer@4207852d] failed

It means you already have a server running on your computer, occupying the port 8080. Stop that server first to start Gutenberg.

Who is occupying that port?

To list the process that's using that port, run from anywhere in your terminal:

$ lsof -i ":8080" | grep LISTEN
nginx 760 youruser 24u IPv6 0x7c71456453ebdc7d 0t0 TCP *:http (LISTEN)

It lists the process currently listening un the port 8080.

In this example, 760 is the pid (process id) of process occupying the port, kill it by typing:

kill -9 760

# Jinks

# Groovy error: no such file

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
IO Exception attempting to load global transforms:/usr/local/Cellar/groovy/2.5.9/libexec/lib/groovy-2.5.9.jar (No such file or directory)

It looks like the installation of Groovy failed. Check the groovy installation function of mrf-env (opens new window) and run each line in your terminal.

Try again.

# Groovy error: grabbing grapes

Run mrf-env -G to fetch the grapes dependency from Marfeel and install it.

Try again.

# Compilation

mrf-def or glue invalidate:section might fail with different outputs:

  • 000 response returned. Is your server running?: This smells like an nginx issue.

For any other error, if the section you are trying to extract uses whiteCollar, start by running glue section:rip. This way, we'll learn if the problem is with the scraping itself or with Gutenberg:

glue section:rip
  • Another failing reason could be a writing error of the InsightToken.(~/.mrf/insightToken.txt).
TypeError: JSRPelRPFLsCLfp9FSAK0DSFIKVeRYLONGTOKEN2kdTrRF is not a legal http header value

To solve this, find the token in MarfeelInsight profile page (opens new window) under the name of secret key and paste it into the InsightToken (~/.mrf/insightToken.txt) file.

# Server error 500

If compilation ends with 500: Internal Server Error, the server, Gutenberg, is stuck somewhere.

One thing is certain: there is no nginx problem, as Gutenberg received the invalidation request all right.

Look for the root cause in Gutenberg logs:

  • java.io.IOException: Cannot run program "mrf-puppeteer":
    • If you haven't, install Puppeteer
    • Once you have:
      1. Stop Gutenberg completely,
      2. Close all terminal windows,
      3. Start Gutenberg in a fresh terminal window
      4. Request again the invalidation in another fresh terminal window

If the above steps don't fix your issue, contact Ada on slack.

# OpenSSL error

If phantomjs output ends with:

dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
 Referenced from: /usr/local/bin/phantomjs
 Reason: image not found

This is an OpenSSL version issue. Try running:

brew uninstall --ignore-dependencies openssl
HOMEBREW_NO_AUTO_UPDATE=1 brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb
brew pin openssl

And try again.

If still have problems, take a look at this Github thread (opens new window).

Phantomjs Deprecation

Phantomjs does not work on new Marfeelers' laptops. Migrate the tenant you are working on to Puppeteer, or raise a hand. This will not be fixed.

# glue invalidate:section fails with FetchError

glue invalidate:section home
Searching for the nearest tenant/s...
(If this takes to long make sure you'r in the right directory)... Found thedrum.mrf.io/index

- FetchError: request to http://localhost.marfeelcache.com/hub/j_spring_security_check failed, reason: connect ECONNREFUSED 127.0.0.1:80

If this error message appears after rebooting your computer, nginx is probably not responsive anymore. Restart it in 2 steps to fix it:

sudo brew services stop nginx
sudo brew services start nginx

TIP

Do not use the brew services restart command.

# Nginx is stopped

If mrf-def returns 000 and Gutenberg is indeed running, the problem might come from Nginx, not transferring the requests to the server.

If the nginx service is stopped, run:

$ brew services stop nginx
$ sudo brew services stop nginx
==> Successfully stopped `nginx` (label: homebrew.mxcl.nginx)

Add sudo at the beginning of the command only if it complains. Once it is successful, run:

$ sudo brew services start nginx
==> Successfully started `nginx` (label: homebrew.mxcl.nginx)

TIP

Make sure you start the service in root.

If this does not solve your nginx issue, run:

brew uninstall --ignore-dependencies openssl
brew install openssl@1.1

Before restarting nginx.

# Marfeel Oooops

If both jinks and the definition compilation are successful, but mrf-open results in the Marfeel Oooops page:

  • If you ran jinks --custom only, try with jinks --build instead.

TIP

In this scenario, nginx is working as expected. This error page is sent from Gutenberg, and wouldn't get to your browser if nginx or Gutenberg were failing.

# Bad Gateway

If both jinks and the definition compilation are successful, but mrf-open results in a 502 Bad GAteway page:

TIP

In this scenario, nginx is working as expected.

# Error installing Marfeel packages

If npm install fails on installing Marfeel packages because of 401 Unauthorized or 404 Not Found errors, you will see an error like this:

$ npm install

# ...

npm ERR! code E401
npm ERR! 401 Unauthorized - GET https://npm.pkg.github.com/marfeel/@marfeel/storybook-preset-react - Your request could not be authenticated by the GitHub Packages service. Please ensure your access token is valid and has the appropriate scopes configured.

it means that something is not right with your global .npmrc config, you will need to set the right package registry in there to install packages from Marfeel.

You can configure your .npmrc using mrf-env -N.

Once finished, installing the npm packages again should succeed.

Check the content of the global .npmrc file.

It should look like:

$ cat ~/.npmrc
@marfeel:registry=https://repositories-proxy.mrf.io/nexus/repository/npm-all

Any other content points to an error during setup. Delete the file and start again.