Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: unexpected end of file while fetching packages during yarn install #4412

Closed
MaxCCC opened this issue Sep 12, 2017 · 10 comments
Closed

Comments

@MaxCCC
Copy link

MaxCCC commented Sep 12, 2017

On our Jenkins on Linux (we use version 1.4 of the frontend-maven-plugin)

[INFO] yarn install v0.23.4
[INFO] [1/4] Resolving packages...
[INFO] [2/4] Fetching packages...
[ERROR] error An unexpected error occurred: "https://url/artifactory/api/npm/npm/rxjs/-/rxjs-5.4.0.tgz: unexpected end of file".

We get this error in 50% of our run's of the job. So sometimes it's working. The unexpected end of file is always on another file so it has nothing to do with that.

Is it a network 'issue'? Sometimes a network warning appears during the fetch. Can we extend some timeout of give jenkins more time to fetch the right packages?

@BYK
Copy link
Member

BYK commented Sep 12, 2017

That looks like a network or system issue. Also, your yarn version looks a bit old. If you switch to a newer version, you may get a more informative error message helping you diagnose the problem.

@MaxCCC
Copy link
Author

MaxCCC commented Sep 12, 2017

@BYK I've upgraded to 0.28.4 (1.0.1 has some different folder settings). But I'm still facing the same issue/log. We just connect with our own artifactory (which we also do from our local machines where we never have this issue). The log isn't clear.

@BYK
Copy link
Member

BYK commented Sep 12, 2017

@MaxCCC can you elaborate on why you cannot use 1.0.1 since there are many fixes on it. Actually, I'd highly recommend using one of the latest nightlies since they have even more fixes.

@BYK
Copy link
Member

BYK commented Sep 12, 2017

We just connect with our own artifactory (which we also do from our local machines where we never have this issue).

May be it is reporting an incorrect Content-Length header that confuses our requests module or Yarn itself?

@MaxCCC
Copy link
Author

MaxCCC commented Sep 12, 2017

@BYK
Because when I use 1.0.1 I got

[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.4:yarn Cannot run program "/xxx/mum-frontend-angular/target/node/yarn/dist/bin/yarn" (in directory "/srv/autobuild/workspace/xxx-frontend-angular"): error=2, No such file or directory
And for now we need this plugin version.

I don't know. Even with -e or -X options it's not telling me anything more. I don't know much about the content-length header

@BYK
Copy link
Member

BYK commented Sep 12, 2017

@MaxCCC

Which version of Node are you using? That sounds like due to an older version of Node not supporting a new option we are using in yarn. Node 4.8, or 5.7+ should be fine for 1.0

For the issue you are experiencing, if you can find a way for us to replicate it, I'd be more than happy to help. Right now I really don't know how or why it happens. If you can switch to 1.0, then I may be able to add more tracing or get you a specific build with more logging for debug.

@MaxCCC
Copy link
Author

MaxCCC commented Sep 13, 2017

@BYK I"ll try to provide some more info. (To upgrade to 1.0 I have to ask/speak with some other people first).
We use the frontend-maven-plugin. The URL will redirect you to how we configure our node and yarn setup for this plugin. We also use node and npm where everything works fine.

  <properties>
    <nodeVersion>v7.10.0</nodeVersion>
    <npmVersion>3.10.10</npmVersion>
    <yarnVersion>v0.23.4</yarnVersion>
    <executable.extension /> <!-- Unix default -->
  </properties>

The command which we are executing is mvn clean source:jar install -Pyarn -DSkipTests.
Often the first time doesn't work and starting a new run immediately after the failed run is most of the time successful. To install Yarn we use our own Artifactory where we have some local yarn repository.

[INFO] Running 'yarn install --https-proxy=http://proxystuff:80 --proxy=http://proxystuff:80' in workspace/..
[INFO] yarn install v0.28.4
[INFO] [1/4] Resolving packages...
[INFO] [2/4] Fetching packages... (fail)

The dependencies are coming from our registry
[ERROR] error An unexpected error occurred: "https:/xxx/artifactory/api/npm/npm/@angular/router/-/router-4.1.2.tgz: unexpected end of file".

@MaxCCC
Copy link
Author

MaxCCC commented Sep 13, 2017

@BYK adding --verbose to the yarn install gives a bit more output:

unexpected end of file
[INFO]     at Zlib._handle.onerror (zlib.js:355:17)

It's maybe a duplicate of expo/create-react-native-app#120 and #4018 but I don't know how to debug this network issue? We use our own artifactory, for npm it's working fine (always). The GET URL's provide an expected output with the URL of our repo on artifactory so it does not try to go to the internet. Is there a way to increase retry's or timeouts or max connections? It seems to me it works very often a second run (like some connections remain open?)

I have to wait for the new release of the plugin to use yarn 1.0.0 or yarn 1.0.1

@MaxCCC
Copy link
Author

MaxCCC commented Sep 13, 2017

@BYK Now we try to connect to our registry without https.
Now we see in the logs: GET https:/xxx/artifactory/... but in our pom, .npmrc, .yarnrc etc we're all specyfing: http://xxx/artifactory:port and some _auth token + strict ssl false etc etc. but we still see this https://URL inside our logs during the GET.

@BYK
Copy link
Member

BYK commented Sep 13, 2017

May I ask why you are setting --https-proxy to an HTTP address? That looks fishy. Also what do you have in your yarn.lock file as the URL for these packages?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants