Troubleshooting pub
Getting a “403” error when publishing a package
You receive the following error when running pub publish
:
1 2 3 |
HTTP error 403: Forbidden ... You aren't an uploader for package '<foo>' |
This problem can occur if one of your accounts was granted permission to publish a package, but the pub client registers you with another account.
You can reset pub’s authentication process by removing the credentials file:
1 |
<span class="pln">rm </span><span class="pun">~/.</span><span class="pln">pub</span><span class="pun">-</span><span class="pln">cache</span><span class="pun">/</span><span class="pln">credentials</span><span class="pun">.</span><span class="pln">json</span> |
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 people authorized to publish new versions of a package. See Authors versus uploaders.
Pub build fails with HttpException error
You receive an HttpException error similar to the following when running pub build
:
1 2 3 4 |
Pub build failed, [1] IsolateSpawnException: 'HttpException: Connection closed while receiving data, ... library handler failed ... |
This can happen as a result of some antivirus software, such as the AVG 2013 Internet security suite. Check the manual for your security suite to see how to temporarily disable this feature. For example, see How to Disable AVG Components.
Pub get fails from behind a corporate firewall
From the command line, pub honors the http_proxy
and https_proxy
environment variables. You can set the proxy server environment variable as follows.
On Linux/macOS:
1 |
<span class="pln">$ export https_proxy</span><span class="pun">=</span><span class="pln">hostname</span><span class="pun">:</span><span class="pln">port</span> |
On Windows:
1 |
<span class="pun">></span> <span class="kwd">set</span><span class="pln"> https_proxy</span><span class="pun">=</span><span class="pln">hostname</span><span class="pun">:</span><span class="pln">port</span> |
If the proxy requires credentials, you can set them as follows.
On Linux/macOS:
1 |
<span class="pln">$ export https_proxy</span><span class="pun">=</span><span class="pln">username</span><span class="pun">:</span><span class="pln">password@hostname</span><span class="pun">:</span><span class="pln">port</span> |
On Windows:
1 |
<span class="pun">></span> <span class="kwd">set</span><span class="pln"> https_proxy</span><span class="pun">=</span><span class="pln">username</span><span class="pun">:</span><span class="pln">password@hostname</span><span class="pun">:</span><span class="pln">port</span> |