Troubleshooting pub

Getting a “403” error when publishing a package

You receive the following error when running pub publish:

  1. HTTP error 403: Forbidden
  2. ...
  3. You aren't an uploader for package '<foo>'

This problem can occur if one of your accounts was granted permission topublish a package, but the pub client registers you with another account.

You can reset pub’s authentication process by removing the credentials file:

  1. $ rm ~/.pub-cache/credentials.json

Getting an “UnauthorizedAccess” error when publishing a package

You receive the following error when running pub publish:

  1. UnauthorizedAccess: Unauthorized user: <username> is not allowed to upload versions to package '<foo>'.

You will see this message if you are not on the list of peopleauthorized to publish new versions of a package.See Uploaders.

Pub build fails with HttpException error

You receive an HttpException error similar to the following whenrunning pub build:

  1. Pub build failed, [1] IsolateSpawnException: 'HttpException: Connection closed while receiving data,
  2. ...
  3. library handler failed
  4. ...

This can happen as a result of some antivirus software, such as theAVG 2013 Internet security suite. Check the manual for your securitysuite to see how to temporarilydisable this feature. For example, seeHow to Disable AVG Components.

Pub get fails from behind a corporate firewall

From the command line, pub honors the http_proxy and https_proxyenvironment variables.You can set the proxy server environment variable as follows.

On Linux/macOS:

  1. $ export https_proxy=hostname:port

On Windows Command Prompt:

  1. $ set https_proxy=hostname:port

On Windows PowerShell:

  1. $ $Env:https_proxy="hostname:port"

If the proxy requires credentials, you can set them as follows.

On Linux/macOS:

  1. $ export https_proxy=username:password@hostname:port

On Windows Command Prompt:

  1. $ set https_proxy=username:password@hostname:port

On Windows PowerShell:

  1. $ $Env:https_proxy="username:password@hostname:port"