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

Cannot install packages from github when offline #1925

Closed
onlywei opened this issue Nov 18, 2016 · 5 comments · Fixed by #3000
Closed

Cannot install packages from github when offline #1925

onlywei opened this issue Nov 18, 2016 · 5 comments · Fixed by #3000

Comments

@onlywei
Copy link

onlywei commented Nov 18, 2016

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

What is the current behavior?
Without an internet connection, I get:

[1/4] 🔍  Resolving packages...
warning There appears to be trouble with your network connection. Retrying...
warning There appears to be trouble with your network connection. Retrying...
warning There appears to be trouble with your network connection. Retrying...
warning There appears to be trouble with your network connection. Retrying...
warning There appears to be trouble with your network connection. Retrying...

And then the install fails and tells me which github address it was trying to reach on the internet.

If the current behavior is a bug, please provide the steps to reproduce.
Just make a package.json with a github dependency, such as:

"nomnom": "douglasduteil/nomnom#next"

Install it via yarn while connected to the internet.
Then unplug your internet, delete node_modules dir, and try to yarn again.

What is the expected behavior?
I expect it to install all my packages from cache even while offline.

Please mention your node.js, yarn and operating system version.
Node 6.9.1 LTS, yarn 0.17.4, Mac OS X 10.11.6

@markstos
Copy link
Contributor

There are conflicting interests here.

When you define that the version of a package you want is a Github branch, then there's no way to know if you've got the most recent version of the code from the branch without connecting to Github and checking.

Using a cached version could result an incorrect result. It seems like the --prefer-offline flag exists for this issue. It's documentation says "'use network only if dependencies are not available in local cache'".

See if yarn install --prefer-offline works for you. Explicitly using this option usefully expresses that you are more interested in a cached result than one which might be inaccurate.

@onlywei
Copy link
Author

onlywei commented Nov 21, 2016

@markstos Thanks. Your response makes sense to me. I will see if pointing the packages to specific Commit Id SHAs works.

To answer your question about the --prefer-offline flag, neither --offline nor --prefer-offline work for me. They both result in the same error:

error An unexpected error occurred: "https://github.com/someone/somerepo.git: getaddrinfo ENOTFOUND github.com github.com:443".

After that, zero packages are installed. Even the ones that are from properly published NPM packages.

I also cannot find any documentation about these flags at https://yarnpkg.com/en/docs/cli/install.

@Kitanga
Copy link

Kitanga commented Dec 5, 2016

@gaearon also this is another issue that is related.

@sce9sc
Copy link

sce9sc commented Dec 13, 2016

Having the same issue.
Windows 10, yarn version : 0.17.10
Followed the steps described https://yarnpkg.com/blog/2016/11/24/offline-mirror
And after creating the new lock file by using yarn install i deleted the node_modules removed the network cable and issuing the command "yarn install" or yarn or "yarn --offline" of "yarn install --prefer-offline" resulted in :

"warning There appears to be trouble with your network connection. Retrying..."

The "npm-packages-offline-cache: directory includes all the .tgz files

An example of the yarn.lock file includes:

THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.

yarn lockfile v1

Base64@~0.2.0:
version "0.2.1"
resolved Base64-0.2.1.tgz#ba3a4230708e186705065e66babdd4c35cf60028

JSONStream@^1.0.3:
version "1.2.1"
resolved JSONStream-1.2.1.tgz#32aa5790e799481083b49b4b7fa94e23bae69bf9
dependencies:
jsonparse "^1.2.0"

@onlywei
Copy link
Author

onlywei commented Jan 31, 2017

@markstos I've tried this again with pointing to a specific git SHA instead of a branch name. I get the same thing. When I unplug my network cable, delete my node_modules folder, and try to yarn again, I still get the same behavior I described in my original issue.

I opened my npm-packages-offline-cache folder, and I noticed that everything package is there as a .tgz file except the one package I installed from Github. That one is there, but its file name is its git commit id SHA. The name of the package is not in the file name at all, and it has no file extension.

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

Successfully merging a pull request may close this issue.

5 participants