An unexpected error occurred: “https://registry.yarnpkg.com/: Not found”

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

What is the current behavior?
I cannot install some packages globally when in Windows and using Git Bash.
For example, for @nrwl/schematics (but also for @angular/cli) I get

$ yarn global add @nrwl/schematics
yarn global v1.7.0
[1/4] Resolving packages...
error An unexpected error occurred: "https://https://registry.yarnpkg.com/@nrwl/schematics: Not found".

Error log:

  Error: https://registry.yarnpkg.com/@nrwl/schematics: Not found
      at Request.params.callback [as _callback] (C:\Program Files (x86)\Yarn\lib\cli.js:65656:18)
      at Request.self.callback (C:\Program Files (x86)\Yarn\lib\cli.js:134675:22)
      at Request.emit (events.js:159:13)
      at Request.<anonymous> (C:\Program Files (x86)\Yarn\lib\cli.js:135658:10)
      at Request.emit (events.js:159:13)
      at IncomingMessage.<anonymous> (C:\Program Files (x86)\Yarn\lib\cli.js:135578:12)
      at Object.onceWrapper (events.js:254:19)
      at IncomingMessage.emit (events.js:164:20)
      at endReadableNT (_stream_readable.js:1062:12)
      at process._tickCallback (internal/process/next_tick.js:152:19)

In Ubuntu it seems to work just fine.
Same if I use the Windows PowerShell instead of Git Bash.

If the current behavior is a bug, please provide the steps to reproduce.
See above

What is the expected behavior?
That packages are installed

Please mention your node.js, yarn and operating system version.

$ node -v
v9.3.0

$ yarn config list
yarn config v1.7.0
info yarn config
{ 'version-tag-prefix': 'v',
  'version-git-tag': true,
  'version-commit-hooks': true,
  'version-git-sign': false,
  'version-git-message': 'v%%s',
  'init-version': '1.0.0',
  'init-license': 'MIT',
  'save-prefix': '^',
  'bin-links': true,
  'ignore-scripts': false,
  'ignore-optional': false,
  registry: 'https://registry.yarnpkg.com',
  'strict-ssl': true,
  'user-agent': 'yarn/1.7.0 npm/? node/v9.3.0 win32 x64',
  lastUpdateCheck: 1527149439512 }
info npm config
{}

Windows 10

Author: Fantashit

17 thoughts on “An unexpected error occurred: “https://registry.yarnpkg.com/: Not found”

  1. This seems to happen randomly – if I run curl repeatedly, the following works around 10%% of the time:

    curl 'https://registry.yarnpkg.com/@types/node/-/node-9.4.2.tgz'
    
  2. Getting the same issue during our CI build, always fails on the same url @Jasu posted. Indeed it seems to happen randomly so I don’t think changing yarn client version or anything will happen. Almost seems like there’s a caching layer in place that has cached a 404 on some of its nodes or something.

  3. Hey all, heads up– Had this same issue on mac and was able to resolve this with the following steps:

    • Upgraded to latest yarn version (might not actually be necessary, but wanted to note it was a step I took)
    • remove node_modules
    • remove yarn.lock
    • yarn install

    And everything worked/installed as expected.

    My hunch is that the salient step is the removal of yarn.lock.

  4. Similar issue:

    > npx create-react-app --info
    
    Environment Info:
    
      System:
        OS: macOS 10.14.4
        CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
      Binaries:
        Node: 12.1.0 - /usr/local/bin/node
        Yarn: 1.15.2 - /usr/local/bin/yarn
        npm: 6.9.0 - /usr/local/bin/npm
      Browsers:
        Chrome: 73.0.3683.103
        Firefox: Not Found
        Safari: 12.1
      npmPackages:
        react: Not Found
        react-dom: Not Found
        react-scripts: Not Found
      npmGlobalPackages:
        create-react-app: Not Found
    
    > npx create-react-app my-app
    
    Creating a new React app in /Users/jklo/projects/jnwc/source/my-app.
    
    Installing packages. This might take a couple of minutes.
    Installing react, react-dom, and react-scripts...
    
    yarn add v1.15.2
    [1/4] 🔍  Resolving packages...
    [2/4] 🚚  Fetching packages...
    error An unexpected error occurred: "https://registry.yarnpkg.com/@csstools/normalize.css/-/normalize.css-9.0.1.tgz: Request failed \"404 Not Found\"".
    info If you think this is a bug, please open a bug report with the information provided in "/Users/jklo/projects/jnwc/source/my-app/yarn-error.log".
    info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
    
    Aborting installation.
      yarnpkg add --exact react react-dom react-scripts --cwd /Users/jklo/projects/jnwc/source/my-app has failed.
    
    Deleting generated file... package.json
    Deleting generated file... yarn.lock
    Done.
    

    yarn-error.log

    Curl can download the package without any problems. Cannot seem to figure out how to even work around this.

    edit: I determined the problem… this is certainly terrible error messaging by yarn or npm (not sure if yarn reimplements npm’s features or not). Turns out in my instance, I had some bad authentication credentials in my ~/.npmrc, that once removed, allowed scoped packages to download again. I’m still a bit confused by my observation to why this was only a problem for some packages, specifically scoped packages.

  5. Hiya, for me it was causing problems due to my strict secure corporate network. It just allowed me to bypass that. I’d just make sure you know what packages you’re installing first, and then flip it back to true afterwards. But I’m far from an expert in this, so if anyone has any insights as to any possible dangers here, I’d love to read about them. Cheers everyone.

  6. Our builds have been failing intermittently with this same error for the last couple of days. The first failure we noticed was at 2019-09-30T00:01 UTC.

    The failures are happening fairly frequently (but not every time, more like 80-90%% of the time). It’s always the same error, but for 4 different packages so far:

    Each of these packages is public, and each version that’s failing is the latest one published, so upgrading to a newer version isn’t an option. Doing a curl request directly from one of the build machines returns a 200 OK response.

    The various suggestions above (and in many other issues) to delete yarn.lock and re-install the modules aren’t going to work, because that completely defeats the point of using a lockfile in the first place. Doing so will upgrade every single transitive dependency, instead of actually fixing what is clearly an intermittent problem with the registry itself.

  7. Oddly enough, I just needed to restart my computer. The good ol’ turn it off and on again. I tried several different things including the above solutions, but restarting did the trick.

  8. $ yarn global add @nrwl/schematics
    yarn global v1.7.0
    [1/4] Resolving packages…
    error An unexpected error occurred: “https://https://registry.yarnpkg.com/@nrwl/schematics: Not found”.

    More info:
    This error happen not only in macOS, but in Linux (Ubuntu, CentOS) too.

    In my case, this error was related to some misfunction in docker, probably after some change on iptables rules.

    After restart docker service, everything works fine for me.
    $ sudo systemctl restart docker

Comments are closed.