yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.44k stars 2.73k forks source link

error message of failed install is not informative #3689

Closed ohir closed 7 years ago

ohir commented 7 years ago

yarn install v0.24.6

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

bug

As in current state it is impossible to tell what package caused install to fail if yarn is used within a script Also the expected hash in shown below message varies from package to package, but got one seems always the same ("da39a3ee5e6b4b0d3255bfef95601890afd80709").

What is the current behavior? yarn install called from create-react-native-app chokes on something that have bad hash but yarn does not mention what package:

$ create-react-native-app MyApp --verbose 
yarn install v0.24.6
[1/4] Resolving packages...
[2/4] Fetching packages...
error Bad hash. Expected "8c2a5ef2472fd9ea742b04c77a75093ba2757c93" but got "da39a3ee5e6b4b0d3255bfef95601890afd80709" 
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
`yarn ` failed
$

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

https://github.com/react-community/create-react-native-app (use toxiproxy to emulate cellular 1Mbps connection for instant reproduction). Small tarballs are ok, bigger ones often are (as written to cache) truncated.

What is the expected behavior? yarn should print some info about the culprit: package / source tarball / cache or offline location

Please mention your node.js, yarn and operating system version. node v6.11.0 yarn v0.24.6 Linux 4.4.70 #23 SMP Wed May 27 05:11:55 UTC 2017 (d45547b) x86_64 x86_64 x86_64 GNU/Linux

Remarks I opened issue with create-react-native-app too: https://github.com/react-community/create-react-native-app/issues/272

ohir commented 7 years ago

Update: I got to immediate cause of errors - corrupted tarballs fetched to the yarn offline folder. Should I open another issue for that (yarn does not verify tarballs put to the offline folder)?

Workaround: after seeing ghost hashes go to your offline folder and make list of corrupted tarballs. Eg: cd yarnofflinefolder && for f in *.tgz; do tar -ztf $f >/dev/null 2>&1 || echo $f; done

bestander commented 7 years ago

@ohir, yes a separate issue would be nice please

aij commented 7 years ago

3269 already fixed this, didn't it?

Edit: Well, almost. PR coming.