Yarn: 403 Forbidden Error when trying to run `yarn install`

Created on 27 Feb 2017  ·  3Comments  ·  Source: yarnpkg/yarn

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
Getting a 403 error when trying to run yarn install

error An unexpected error occurred: "http://npm.myCompany.com/angular-froala/-/angular-froala-1.2.7.tgz: Request failed \"403 Forbidden\"".

(btw it gives the same error on a different package everytime, so its not related to froala)

If the current behavior is a bug, please provide the steps to reproduce.
Run yarn

What is the expected behavior?
yarn.lock file should be created

Please mention your node.js, yarn and operating system version.
Yarn version:
0.20.3
Node version:
4.2.1
Platform:
darwin x64

When I do yarn login i get this-

yarn login v0.20.3
info npm username: **myUsername**
info npm username: **myEmail**
✨  Done in 0.11s.

Most helpful comment

@krishnagupta21 Can you share a bit more in detail how you fixed this? I think we have the same issue. Sometimes ouryarn install works but sometimes it fails with a 403(always on a different package).
Npm install is always working.

All 3 comments

Fixed the issue.We were using https for our registry even though it was http. NPM was still working with https though, but yarn was giving 403.

@krishnagupta21 Can you share a bit more in detail how you fixed this? I think we have the same issue. Sometimes ouryarn install works but sometimes it fails with a 403(always on a different package).
Npm install is always working.

@krishnagupta21 Can you share a bit more in detail how you fixed this? I think we have the same issue. Sometimes ouryarn install works but sometimes it fails with a 403(always on a different package).
Npm install is always working.

My university wi-fi block all the http connections. So, I went to _yarn.lock_ file and searched for all http:, added s to the ending, so that it looked like https: and checked the link by copypasting it to browser, the link was working, since browser found an archive file to download. Then I ran yarn install and it completed successfully, I hope it will work fine further, we'll see.

Hopefully it will help somebody to fix it faster, all you have to do is change all http: in your yarn.lock to https:
e.g. Change this

onetime@^2.0.0:
  version "2.0.1"
  resolved "http://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4"

To this

onetime@^2.0.0:
  version "2.0.1"
  resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4"

Good luck!

Was this page helpful?
0 / 5 - 0 ratings