Pivotal Knowledge Base

Follow

Failure pushing build pack "`initialize': can't convert nil into String (TypeError)"

Symptoms

You are pushing an a Ruby based application and seeing the following error.

[STG]     OUT -----> Installing dependencies using 1.6.3
[STG]     OUT        Purging Cache. Changing stack from cedar to
[STG]     OUT        Fixing nokogiri install. Clearing bundler cache.
[STG]     OUT        See https://github.com/sparklemotion/nokogiri/issues/923.
[STG]     ERR /usr/lib/ruby/1.9.1/pathname.rb:308:in `initialize': can't convert nil into String (TypeError)

Resolution

To avoid the error displayed above, set an environment variable called `STACK` to `` (i.e. an empty string).  There are two ways that this can be done.

  1. By using the `cf set-env` command.
    cf set-env <app-name> STACK ""
  2. By modifying the `env` block of your manifest.yml file.
    ---
    applications:
    - name: <app-name>
      memory: <memory-limit>
      path: .
      env:
        STACK: ""

This works to resolve the issue as the presence of the `STACK` environment variable causes the build pack to avoid the code path which triggers this error.

Additional Information

While less convenient, it is also possible to resolve this issue by deleting your application and pushing it again.

cf delete <app-name>

This resolves the issue because it clears out the build pack cache, which when in a certain state is another one of the triggers for this problem.

 

Comments

Powered by Zendesk