Seems that yarn is creating a json file without contents and perhaps should be {}
.
error SyntaxError: /Users/thomasreggi/.yarn-cache/npm-repeating-1.1.3/.yarn-metadata.json: Unexpected end of JSON input
at Object.parse (native)
at Object.<anonymous> (/Users/thomasreggi/.yarn/lib/util/fs.js:260:54)
at next (native)
at step (/Users/thomasreggi/.yarn/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
at /Users/thomasreggi/.yarn/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:20
at run (/Users/thomasreggi/.yarn/node_modules/core-js/library/modules/es6.promise.js:87:22)
at /Users/thomasreggi/.yarn/node_modules/core-js/library/modules/es6.promise.js:100:28
at flush (/Users/thomasreggi/.yarn/node_modules/core-js/library/modules/_microtask.js:18:9)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
Also seeing this:
Unhandled rejection Error: Command failed: yarn install
warning denali > trash > run-applescript > execa > [email protected]: cross-spawn no longer requires a build toolchain, use it instead!
error SyntaxError: /Users/iradchenko/.yarn-cache/npm-morgan-1.7.0/.yarn-metadata.json: Unexpected end of JSON input
at Object.parse (native)
at Object.<anonymous> (/Users/iradchenko/.nave/installed/6.7.0/lib/node_modules/yarn/lib/util/fs.js:260:54)
at next (native)
at step (/Users/iradchenko/.nave/installed/6.7.0/lib/node_modules/yarn/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
at /Users/iradchenko/.nave/installed/6.7.0/lib/node_modules/yarn/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:20
We hit this at Exponent after getting a prior installation error due to a bad hash in the yarn.lock file. Current hypothesis is that a bad hash or other installation error causes Yarn to bail out and not properly clean up .yarn-metadata.json files.
I triggered this condition after a failed install of lodash.isfunction
:
[2/4] Fetching packages...
error https://registry.npmjs.org/lodash.isfunction/-/lodash.isfunction-2.4.1.tgz: invalid tar file
at Extract.Parse._startEntry (/usr/local/lib/node_modules/yarn/node_modules/tar/lib/parse.js:149:13)
at Extract.Parse._process (/usr/local/lib/node_modules/yarn/node_modules/tar/lib/parse.js:131:12)
at BlockStream.<anonymous> (/usr/local/lib/node_modules/yarn/node_modules/tar/lib/parse.js:47:8)
at emitOne (events.js:77:13)
at BlockStream.emit (events.js:169:7)
at BlockStream._emitChunk (/usr/local/lib/node_modules/yarn/node_modules/block-stream/block-stream.js:145:10)
at BlockStream.write (/usr/local/lib/node_modules/yarn/node_modules/block-stream/block-stream.js:45:10)
at Extract.Parse.write (/usr/local/lib/node_modules/yarn/node_modules/tar/lib/parse.js:81:23)
at UnpackStream.ondata (_stream_readable.js:536:20)
at emitOne (events.js:77:13)
at UnpackStream.emit (events.js:169:7)
If you trigger this, you can workaround the issue with:
yarn cache clean
Then try your install again. In my case, the re-try worked.
We were getting this on yarn 0.22 (installed via npm). We resolved it by upgrading to yarn 0.23.1 (installed via apt) and then running yarn cache clean
.
Should be fixed now
Set the problem with the command "native command-inactive
After running the "yarn cache clean" command, it worked normally, thanks for the tip.
Command failed: yarn add [email protected]
error An unexpected error occurred: "/home/musigwa/.cache/yarn/v1/npm-react-native-tab-view-0.0.65-b685ea3081ff7c96486cd997361026c407302c59/.yarn-metadata.json: Unexpected end of JSON input".
i got this error while running ignite new FirstApp
anyone to help me???
@Musigwa, looks like your cache might be corrupt.
Try running yarn cache clean
and then install again
thank you i'm going to try it out
Thanks at all it worked fine
On Mon, Mar 5, 2018, 19:39 Konstantin Raev notifications@github.com wrote:
@Musigwa https://github.com/musigwa, looks like your cache might be
corrupt.
Try running yarn cache clean and then install again—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/yarnpkg/yarn/issues/660#issuecomment-370500429, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AcnBQGaZ3iQ6JH6DPfRObZLqVzuOu5wOks5tbXg1gaJpZM4KT5XQ
.
I triggered this condition after a failed install of
lodash.isfunction
:[2/4] Fetching packages... error https://registry.npmjs.org/lodash.isfunction/-/lodash.isfunction-2.4.1.tgz: invalid tar file at Extract.Parse._startEntry (/usr/local/lib/node_modules/yarn/node_modules/tar/lib/parse.js:149:13) at Extract.Parse._process (/usr/local/lib/node_modules/yarn/node_modules/tar/lib/parse.js:131:12) at BlockStream.<anonymous> (/usr/local/lib/node_modules/yarn/node_modules/tar/lib/parse.js:47:8) at emitOne (events.js:77:13) at BlockStream.emit (events.js:169:7) at BlockStream._emitChunk (/usr/local/lib/node_modules/yarn/node_modules/block-stream/block-stream.js:145:10) at BlockStream.write (/usr/local/lib/node_modules/yarn/node_modules/block-stream/block-stream.js:45:10) at Extract.Parse.write (/usr/local/lib/node_modules/yarn/node_modules/tar/lib/parse.js:81:23) at UnpackStream.ondata (_stream_readable.js:536:20) at emitOne (events.js:77:13) at UnpackStream.emit (events.js:169:7)
If you trigger this, you can workaround the issue with:
yarn cache clean
Then try your install again. In my case, the re-try worked.
thx
This might help someone...perhaps, I might be needing it in the future.
It's not uncommon in this space...
I was having this issue while trying to work on a project that required using yarn
. So I ran yarn
and was receiving this error message:
yarn install v1.16.0
[1/4] Resolving packages...
[2/4] Fetching packages...
error An unexpected error occurred: "C:\\Users\\MumsyIre\\AppData\\Loc al\\Yarn\\Cache\\v4\\npm-escape-string-regexp-1.0.5-1b61c0562190a8dff6 ae3bb2cf0200ca130b86d4\\node_modules\\escape-string-regexp\\.yarn-meta data.json: Unexpected token \u0000 in JSON at position 0".
info If you think this is a bug, please open a bug report with the inf ormation provided in "C:\\Users\\MumsyIre\\Desktop\\MyFiles\\operation al-ui\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation a bout this command.
--
Problem: Corrupt cache
Solution: Clean up your cache by running yarn cache clean
Source: @bestander
Thanks @bestander
Don't forget that if you get this error on windows it can be because you have an empty package.json in your home directory (C:\Users\yourlogin\package.json).
If you have the empty file there just delete it and you are on track again.
Don't forget that if you get this error on windows it can be because you have an empty package.json in your home directory (C:\Users\yourlogin\package.json).
If you have the empty file there just delete it and you are on track again.
You really saved my life! I tried all possible things and hunderts of reinstalls... :-)
Don't forget that if you get this error on windows it can be because you have an empty package.json in your home directory (C:\Users\yourlogin\package.json).
If you have the empty file there just delete it and you are on track again.
Thank you! This also solved my problem with yarn!
I'm running the yarn install procedure within a Dockerfile, there's no cache. It's retrieving the dependencies directly from a registry. Why is this still a thing? Also I have seen this issue with icu4c-data/.yarn-metadata.json
most of the time.
Most helpful comment
I triggered this condition after a failed install of
lodash.isfunction
:If you trigger this, you can workaround the issue with:
Then try your install again. In my case, the re-try worked.