1

I get the following error whenever I run: 'heroku local web'

.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [java.lang.Integer] for value '$PORT'; nested exception is java.lang.NumberFormatException: For input string: "$PORT"

My Procfile looks like this:

web: java -Dserver.port=$PORT -jar build/libs/gs-spring-boot-0.1.0.jar

I am able to deploy to heroku, but I would like to be able to run locally to verify deployment before deploying remotely.

I have a windows PORT system environment variable, and a Heroku config variable set with 'heroku config:set PORT=8080.' I set each of these independently with no change in the above error. Anyone know why I getting this?

1
  • I have also tried 'heroku local web -p 8080' and get the same exception. A workaround is to replace '$PORT' with '8080' in the Procfile, but I would rather not do this if possible. Commented Mar 7, 2016 at 19:50

1 Answer 1

3

On Windows, you need to reference environment variables like %PORT% instead of the $ notation, which is *nix specific.

To fix this, you should create a Procfile.windows file with these contents:

web: java -Dserver.port=%PORT% -jar build\libs\gs-spring-boot-0.1.0.jar

And then run this command:

heroku local web -f Procfile.windows
Sign up to request clarification or add additional context in comments.

1 Comment

I was looking exactly for this. Thank you very much !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.