Yarn: An unexpected error occured

Created on 21 Oct 2016  路  6Comments  路  Source: yarnpkg/yarn

Do you want to request a _feature_ or report a _bug_?

Report a bug

What is the current behavior?

yarn add webpack autoprefixer fails to install deps

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

I ran yarn add webpack autoprefixer and face an error:

info No lockfile found.
[1/4] 馃攳 Resolving packages...
error An unexpected error occured, please open a bug report with the information provided in "/Users/sullenor/Documents/repo/sullenor.github.io/yarn-error.log".

The log file:

Arguments: 
  /usr/local/Cellar/node/6.9.1/bin/node /Users/sullenor/.npm-global/bin/yarn add webpack autoprefixer

PATH: 
  ./node_modules/.bin:/Users/sullenor/.npm-global/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Yarn version: 
  0.16.1

Node version: 
  6.9.1

Platform: 
  darwin x64

npm manifest: 
  {
    "name": "sullenor.github.io",
    "version": "1.0.0",
    "description": "My Sweet Homepage",
    "main": "gulpfile.babel.js",
    "dependencies": {},
    "devDependencies": {},
    "scripts": {
      "test": "echo \"Error: no test specified\" && exit 1"
    },
    "repository": {
      "type": "git",
      "url": "git+https://github.com/sullenor/sullenor.github.io.git"
    },
    "author": "Alexey Litvinov",
    "license": "MIT",
    "bugs": {
      "url": "https://github.com/sullenor/sullenor.github.io/issues"
    },
    "homepage": "https://github.com/sullenor/sullenor.github.io#readme"
  }

yarn manifest: 
  No manifest

bower manifest: 
  No manifest

Lockfile: 
  No lockfile

Trace: 
  TypeError: Cannot use 'in' operator to search for 'latest' in undefined
      at /Users/sullenor/.npm-global/lib/node_modules/yarn/lib/resolvers/registries/npm-resolver.js:62:24
      at next (native)
      at step (/Users/sullenor/.npm-global/lib/node_modules/yarn/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
      at /Users/sullenor/.npm-global/lib/node_modules/yarn/node_modules/babel-runtime/helpers/asyncToGenerator.js:35:14
      at Promise.F (/Users/sullenor/.npm-global/lib/node_modules/yarn/node_modules/core-js/library/modules/_export.js:35:28)
      at /Users/sullenor/.npm-global/lib/node_modules/yarn/node_modules/babel-runtime/helpers/asyncToGenerator.js:14:12
      at Function.findVersionInRegistryResponse (/Users/sullenor/.npm-global/lib/node_modules/yarn/lib/resolvers/registries/npm-resolver.js:72:7)
      at /Users/sullenor/.npm-global/lib/node_modules/yarn/lib/resolvers/registries/npm-resolver.js:89:34
      at next (native)
      at step (/Users/sullenor/.npm-global/lib/node_modules/yarn/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)

What is the expected behavior?

Yarn installs dependencies

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

macOS Sierra 10.12

Yarn version:
0.16.1

Node version:
6.9.1

Most helpful comment

I'm running into this as well when running yarn outdated. It seems to be stemming from a DNS resolution issue of http://registry.yarnpkg.com/ (possibly due to the recent wake of DNS DDoS attacks).

All 6 comments

I'm running into this as well when running yarn outdated. It seems to be stemming from a DNS resolution issue of http://registry.yarnpkg.com/ (possibly due to the recent wake of DNS DDoS attacks).

Heh, looks like this is one place Yarn's "offline mode" falls short. It should probably fallback to offline mode if you're online but services are degraded (for example, DNS is busted).

offline, cached seems to be working but with packages you've never installed it is not possible of course.
Although I would like to see an error similar to npm does now e.g

npm ERR! fetch failed https://registry.npmjs.org/karma-jasmine/-/karma-jasmine-1.0.2.tgz

workaround:

# .npmrc
registry = https://registry.npmjs.org/

This is also mentioned here #1348

registry.yarnpkg.com is now bypassing DNS to registry.npmjs.org so this should no longer be a problem

Was this page helpful?
0 / 5 - 0 ratings