Do you want to request a feature or report a bug?
Bug
What is the current behavior?
yarn install quits silently if fetching one of the packages times out during fetch phase due to package size and/or network lag.
Result:
(Shortened) example output:
$ yarn install --verbose
yarn install v1.5.1
[...]
[1/4] Resolving packages...
warning: [...]
[2/4] Fetching packages...
verbose 1.45 Performing "GET" request to "https://registry.yarnpkg.com/envfile/-/envfile-2.3.0.tgz".
[...]
verbose 20.696 Performing "GET" request to "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.2.tgz".
$
If the current behavior is a bug, please provide the steps to reproduce.
git clone https://github.com/theia-ide/theia-appscd theia-apps/theia-java-dockermv next.package.json package.jsonyarn install(Retry until it fails, maybe use slow internet connection)
The large package here is @theia/java, which clocks in at around 33MB.
What is the expected behavior?
yarn install prints an error message with the timeout, the package name and url it failed to fetch. Finally, it quits with a return code != 0.
Please mention your node.js, yarn and operating system version.
8.101.5.1node:8.1016.04)Update:
Maybe related: #5055
Update 2:
Neither increasing --network-timeout nor setting --mutex network helped. Interestingly, the yarn install quits long before the network timeout is due (e.g., timeout 60000ms, yarn install quits after 35s).
Update 3:
I noticed that in the cases where it fails locally (via docker run ...), my system monitor shows a very slow download (~150Kb/s on a 50 Mb/s connection). The other runs go with ~5 Mb/s).
I attempted to reproduce this by setting the timeout passed to the request lib to 1 but it does throw an error in that case:
~/Projects/yarn-test ๐ yarndev add @theia/java
yarn add v1.6.0-0
[1/4] ๐ Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/@theia%2fjava: ETIMEDOUT".
info If you think this is a bug, please open a bug report with the information provided in "/Users/jvalore/Projects/yarn-test/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Not sure how else to try to repro this ๐ค maybe I can simulate a slow network somehow...
Next attempt, used Apple's "Network Link Conditioner" to simulate DSL speed. This took >2min to download that package, but still finished
~/Projects/yarn-test ๐ yarndev add @theia/java
yarn add v1.6.0-0
[1/4] ๐ Resolving packages...
[2/4] ๐ Fetching packages...
warning [email protected]: The engine "vscode" appears to be invalid.
[3/4] ๐ Linking dependencies...
[4/4] ๐ Building fresh packages...
success Saved 1 new dependency.
info Direct dependencies
โโ @theia/[email protected]
info All dependencies
โโ @theia/[email protected]
โจ Done in 147.88s.
then I tried turning off my network half way through the download. That also caught the error:
~/Projects/yarn-test ๐ yarndev add @theia/java
yarn add v1.6.0-0
[1/4] ๐ Resolving packages...
[2/4] ๐ Fetching packages...
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.yarnpkg.com/@theia/java/-/java-0.3.7.tgz: connect ENETUNREACH 104.16.59.173:443 - Local (0.0.0.0:49668)".
info If you think this is a bug, please open a bug report with the information provided in "/Users/jvalore/Projects/yarn-test/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
There must be some really weird edge case here... (or maybe it only happens on linux?)
That's really strange. Maybe it's related to running in docker? The build is executed with jenkins in a Docker build agent, but I can run the build in docker on my laptop and reproduce it in ~20% of the runs.
Update: Dockerfile to reproduce
FROM node:8.10
COPY . . # <- the files from the example above
RUN yarn install
RUN ls -al node_modules
This may be a scenario to reproduce similar problem on Windows env:
https://github.com/yarnpkg/yarn/issues/5512
Update 3:
I noticed that in the cases where it fails locally (viadocker run ...), my system monitor shows a very slow download (~150Kb/s on a 50 Mb/s connection). The other runs go with ~5 Mb/s).
We don't use a yarn cache in our environment. Could it be that npmjs throttles/terminates repeated downloads from the same IP?
Several of my teammates experienced this issue on OS X 10.13.3 with Node 5.12.0 and Yarn 1.5.1. Some comments in #764, an issue with some similarity to this one, said upgrading to Node >= 6.9.5 fixes that issue. So my teammates tried upgrading Node to the latest (9.8.0), and that did the trick! My suspicion is that the DNS caching that was recently adding to Yarn (#4447) may not work correctly with Node < 6.9.5, but it's only a hunch.
Maybe related to #5473?
@rally25rs I'm still getting it regularly, is there any specific options you'd like me to try, information to provide?
We run it from a docker container built from node:8.10-stretch.
@jneves I normally debug through the Chrome dev tools using node --inspect-brk ~/Projects/yarn/bin/yarn.js but doing it in a Docker container might be problematic. Does it happen outside a docker container? If not, then there might be some resource limit (like drive space?) being hit in docker?
same issue here, run it from a docker container.
Same issue here, also running from a docker container, would be happy to assist you in debugging this if you let me know how I can help?
I have the same issue when running it on a drone.io on a docker container.
In my case, docker container did not know our private npm registry ip address...
yarn install goes end, and it is resolved.
sorry
For me problem was in wrong definition of dependency:
"devDependencies": {
"gulp": "git+https://github.com/gulpjs/gulp.git"
}
This is acceptable for npm btw.
I'm experiencing the same issue using yarn 1.13.0, node 11.9.0, the issue seems to be caused by problems downloading a private package due to slow download speed using a VPN.
The installation was silently failing for me as well, only way I could figure the issue out was by setting --network-concurrency to 1. It'd nice to catch these kind of issues out of the box without any workaround, though.
I have the same problem with yarn v1.12.3
If packages fail to install the exit code is 0 with no error output
Same problem in v1.13.0
Step 1/11 : FROM node:10
...
Step 8/11 : RUN yarn install --frozen-lockfile
---> Running in 9174a622f137
yarn install v1.13.0
[1/4] Resolving packages...
[2/4] Fetching packages...
Removing intermediate container 9174a622f137
---> b151f7407bd8
Step 9/11 : COPY . /app
---> c014809a3bce
CI pipeline does not fail => the node_modules folder don't exist in the docker image.
The workaround to make sure the CI pipeline fail is to check whether node_modules is exist
Step 8/11 : RUN yarn install --frozen-lockfile && ls node_modules
For me the culprit was an antivirus (Dr.Web) that monitors http/https request and blocks "dangerous" domains silently.... In my case it was https://raw.githubusercontent.com. Adding it to whitelist of antivirus solved the issue.
Use --verbose to see which url is blocked and then try to open it in browser. If you see something like ERR_SSL_PROTOCOL_ERROR - then the culprit is your firewall or antivirus.
Had this when running yarn v1.1.3.0 inside docker, after upgrading to v1.17.3 (nodejs 12.7.0), it behaves normal now.
@philaw we also use yarn 1.13.0 and encountered this bug. I'll try to upgrade to 1.17.3.
Most helpful comment
Had this when running yarn v1.1.3.0 inside docker, after upgrading to v1.17.3 (nodejs 12.7.0), it behaves normal now.