Yarn: `invalid tar file` when installing non-tar file

Created on 23 Nov 2016  ·  3Comments  ·  Source: yarnpkg/yarn


$ yarn --version
0.17.8

Do you want to request a feature or report a bug?
feature or compatibility bug (with bower)

What is the current behavior?
Adding this dependency to bower.json and running bower install works fine:

    "open-sans": "http://themes.googleusercontent.com/static/fonts/opensans/v6/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff"

Attempt similar with package.json fails with :

error An unexpected error occurred: "http://themes.googleusercontent.com/static/fonts/opensans/v6/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff: invalid tar file".

If the current behavior is a bug, please provide the steps to reproduce.
This should do the trick :
yarn add http://themes.googleusercontent.com/static/fonts/opensans/v6/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff

What is the expected behavior?
I expect the same behaviour as bower - ie I get the font file in a local directory, preferably with some sensible name in the path.

Please mention your node.js, yarn and operating system version.
yarn-error.log file (manually edited for privacy):

Arguments: 
  /home/maxw/.nvm/versions/node/v6.9.1/bin/node /home/maxw/.nvm/versions/node/v6.9.1/bin/yarn add http://themes.googleusercontent.com/static/fonts/opensans/v6/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff

PATH: 
  /home/maxw/.nvm/versions/node/v6.9.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

Yarn version: 
  0.17.8

Node version: 
  6.9.1

Platform: 
  linux x64

npm manifest: 
  {
    "name": "irrelevant",
    "version": "0.0.0",
    "main": "tour.html",
    "repository": "[email protected]:irrelevant_dev/irrelevant",
    "author": "Max Waterman",
    "license": "UNLICENSED",
    "dependencies": {
      "Polymer": "^1.6.1--",
      "modernizr": "^3.3.1",
      "webcomponentsjs": "^1.0.2",
      "open-sans": "http://themes.googleusercontent.com/static/fonts/opensans/v6/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff"
    },
    "resolutions": {}
  }

yarn manifest: 
  No manifest

Lockfile: 
  # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
  # yarn lockfile v1


  Polymer@^1.6.1--:
    version "1.6.1--"
    resolved "https://registry.yarnpkg.com/Polymer/-/Polymer-1.6.1--.tgz#6bdc3df856c7cf146c0e0153b8e4ac65137d4342"

  ansi-regex@^2.0.0:
    version "2.0.0"
    resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.0.0.tgz#c5061b6e0ef8a81775e50f5d66151bf6bf371107"

  camelcase@^2.0.1:
    version "2.1.1"
    resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f"

  cliui@^3.0.3:
    version "3.2.0"
    resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d"
    dependencies:
      string-width "^1.0.1"
      strip-ansi "^3.0.1"
      wrap-ansi "^2.0.0"

  code-point-at@^1.0.0:
    version "1.1.0"
    resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77"

  decamelize@^1.1.1:
    version "1.2.0"
    resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"

  [email protected]:
    version "1.1.0"
    resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.1.0.tgz#1c36612937cf7d1596b983e9c5d0c6233eeaa3cf"
    dependencies:
      esutils "^1.1.6"
      isarray "0.0.1"

  esutils@^1.1.6:
    version "1.1.6"
    resolved "https://registry.yarnpkg.com/esutils/-/esutils-1.1.6.tgz#c01ccaa9ae4b897c6d0c3e210ae52f3c7a844375"

  [email protected]:
    version "0.2.2"
    resolved "https://registry.yarnpkg.com/file/-/file-0.2.2.tgz#c3dfd8f8cf3535ae455c2b423c2e52635d76b4d3"

  [email protected]:
    version "0.3.0"
    resolved "https://registry.yarnpkg.com/find-parent-dir/-/find-parent-dir-0.3.0.tgz#33c44b429ab2b2f0646299c5f9f718f376ff8d54"

  invert-kv@^1.0.0:
    version "1.0.0"
    resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6"

  is-fullwidth-code-point@^1.0.0:
    version "1.0.0"
    resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb"
    dependencies:
      number-is-nan "^1.0.0"

  [email protected]:
    version "0.0.1"
    resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf"

  lcid@^1.0.0:
    version "1.0.0"
    resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835"
    dependencies:
      invert-kv "^1.0.0"

  [email protected]:
    version "4.0.0"
    resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.0.0.tgz#9ac43844c595e28d30108b7ba583703395922dfc"

  [email protected]:
    version "0.3.5"
    resolved "https://registry.yarnpkg.com/marked/-/marked-0.3.5.tgz#4113a15ac5d7bca158a5aae07224587b9fa15b94"

  [email protected]:
    version "0.0.8"
    resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d"

  [email protected]:
    version "0.5.1"
    resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903"
    dependencies:
      minimist "0.0.8"

  modernizr@^3.3.1:
    version "3.3.1"
    resolved "https://registry.yarnpkg.com/modernizr/-/modernizr-3.3.1.tgz#2170b3438a7478c16654324f004802aae6a863e9"
    dependencies:
      doctrine "1.1.0"
      file "0.2.2"
      find-parent-dir "0.3.0"
      lodash "4.0.0"
      marked "0.3.5"
      mkdirp "0.5.1"
      requirejs "2.1.22"
      yargs "3.31.0"

  number-is-nan@^1.0.0:
    version "1.0.1"
    resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d"

  os-locale@^1.4.0:
    version "1.4.0"
    resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-1.4.0.tgz#20f9f17ae29ed345e8bde583b13d2009803c14d9"
    dependencies:
      lcid "^1.0.0"

  [email protected]:
    version "2.1.22"
    resolved "https://registry.yarnpkg.com/requirejs/-/requirejs-2.1.22.tgz#dd78fd2d34180c0d62c724b5b8aebc0664e0366f"

  string-width@^1.0.1:
    version "1.0.2"
    resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3"
    dependencies:
      code-point-at "^1.0.0"
      is-fullwidth-code-point "^1.0.0"
      strip-ansi "^3.0.0"

  strip-ansi@^3.0.0, strip-ansi@^3.0.1:
    version "3.0.1"
    resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf"
    dependencies:
      ansi-regex "^2.0.0"

  webcomponentsjs@^1.0.2:
    version "1.0.2"
    resolved "https://registry.yarnpkg.com/webcomponentsjs/-/webcomponentsjs-1.0.2.tgz#b028914c579a61d8144913c7c94c2cf73b95fc69"

  window-size@^0.1.4:
    version "0.1.4"
    resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.4.tgz#f8e1aa1ee5a53ec5bf151ffa09742a6ad7697876"

  wrap-ansi@^2.0.0:
    version "2.0.0"
    resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.0.0.tgz#7d30f8f873f9a5bbc3a64dabc8d177e071ae426f"
    dependencies:
      string-width "^1.0.1"

  y18n@^3.2.0:
    version "3.2.1"
    resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41"

  [email protected]:
    version "3.31.0"
    resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.31.0.tgz#9f28210aaa0a796570e99505644b968f5e41a1bc"
    dependencies:
      camelcase "^2.0.1"
      cliui "^3.0.3"
      decamelize "^1.1.1"
      os-locale "^1.4.0"
      string-width "^1.0.1"
      window-size "^0.1.4"
      y18n "^3.2.0"

Trace: 
  Error: http://themes.googleusercontent.com/static/fonts/opensans/v6/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff: invalid tar file
      at Extract.Parse._startEntry (/home/maxw/.nvm/versions/node/v6.9.1/lib/node_modules/yarn/node_modules/tar/lib/parse.js:149:13)
      at Extract.Parse._process (/home/maxw/.nvm/versions/node/v6.9.1/lib/node_modules/yarn/node_modules/tar/lib/parse.js:131:12)
      at BlockStream.<anonymous> (/home/maxw/.nvm/versions/node/v6.9.1/lib/node_modules/yarn/node_modules/tar/lib/parse.js:47:8)
      at emitOne (events.js:96:13)
      at BlockStream.emit (events.js:188:7)
      at BlockStream._emitChunk (/home/maxw/.nvm/versions/node/v6.9.1/lib/node_modules/yarn/node_modules/block-stream/block-stream.js:145:10)
      at BlockStream.write (/home/maxw/.nvm/versions/node/v6.9.1/lib/node_modules/yarn/node_modules/block-stream/block-stream.js:45:10)
      at Extract.Parse.write (/home/maxw/.nvm/versions/node/v6.9.1/lib/node_modules/yarn/node_modules/tar/lib/parse.js:81:23)
      at UnpackStream.ondata (_stream_readable.js:555:20)
      at emitOne (events.js:96:13)

All 3 comments

npm doesn't allow installation of this. You mention bower and we removed bower support, so I'm not sure this would be added at this time.

/cc @kittens

Yeah this isn't something we're going to add. This would also make supporting any other archive type a breaking change since we'd be changing the this behaviour if it were implemented.

This is disappointing - I was hoping to do without bower.

Was this page helpful?
0 / 5 - 0 ratings