https://github.com/realm/realm-js/issues/1645
It seems like the pull request or any solution has not infected current version.
I can't download realm-sync-cocoa-3.5.5.tar.gz
realm: 2.8.5
react-native: 0.55.4
@jfan0888 Do you live in any of the countries mentioned in https://github.com/realm/realm-js/blob/master/README.md#license?
@kneth
@jfan0888 We are allowed to export to China 馃嚚馃嚦
Please post the error message so I can see how it goes wrong.
OK @kneth . You can notice that what I faced.
@jfan0888 Do you connect to internet through a proxy?
@kneth yeah
I am not sure how well node-fetch is supporting proxies. At least our downloader doesn't take care of it: https://github.com/realm/realm-js/blob/master/scripts/download-realm.js#L66
Can you try to manually download it: curl https://static.realm.io/downloads/sync/realm-sync-cocoa-3.3.0.tar.gz -O to verify that your network can access the file?
@kneth it didn't solve the problem.
@kneth I verified that it works properly although the Internet speed is a bit slow.
@kneth what do you think of Internet speed?
When i run the instruction you mentioned above, it is said that it will take more than 4 hours even though its size is only 135MB.
static.realm.io is hosted by Amazon S3 so I can't imagine that the bottleneck is at our end. 4 hours for 135 MB is less than 10 Kbit/sec so maybe you should check your internet connection.
I improved network speed 10 times than before. But I couldn't succeeded in solving the problem.
It sounds like an issue at your end rather than at our end.
I couldn't find solution on my end.
Let me suggest that you contact your internet provider to see if they can speed up the transfer.
I happend to experienced this issue today.When I try to run my app from Xcode after installed realm.I got this error as below:
Resolved requirements: { SYNC_SERVER_FOLDER: 'sync',
SYNC_ARCHIVE: 'realm-sync-cocoa-3.7.0.tar.gz',
SYNC_ARCHIVE_ROOT: 'core' }
No lockfile found at the target, proceeding.
Download url: https://static.realm.io/downloads/sync/realm-sync-cocoa-3.7.0.tar.gz
Extracting realm-sync-cocoa-3.7.0.tar.gz => /Users/xxx/Desktop/xxx/node_modules/realm/vendor/realm-ios
{ Error: unexpected end of file
at Zlib.zlibOnError [as onerror] (zlib.js:142:17) errno: -5, code: 'Z_BUF_ERROR' }
Command /bin/sh failed with exit code 1
I solved this issue manually based on @kneth 's answer,here are my steps:
First step:
open cmd, locate to your project directory/node_modules/realm/vendor/realm-ios,you will find it is empty馃槉
Second step
vim download-realm.lock,then write
SYNC_SERVER_FOLDER=sync
SYNC_ARCHIVE=realm-sync-cocoa-3.7.0.tar.gz
SYNC_ARCHIVE_ROOT=core into this file.
Save and exit.
Remember to change the version number to what you need.
Third step
open another cmd,locate to your downloaded file "realm-sync-cocoa-3.7.0.tar.gz"
excute this command tar -xzvf realm-sync-cocoa-3.7.0.tar.gz -C yourProjectDirectory/node_modules/realm/vendor/realm-ios
Fourth step
open the first cmd,you will find the directory is not empty any more.copy all the files under directory "core" and paste them under directory "yourProjectDirectory/node_modules/realm/vendor/realm-ios"
Finally,build and run,you will make it.
@Arabrellaxy Thank you for the recipe. I think we should include it in our documentation. Downloading works in most cases, but it is always good to have a plan B.
I believe there is a bug in download-realm.js but it is only triggered in rare cases. I have documented (will be online soon).
I'm not sure this recipe works every time. When using it today I'm getting:
Resolved requirements: { SYNC_SERVER_FOLDER: 'sync',
SYNC_ARCHIVE: 'realm-sync-cocoa-3.5.1.tar.gz',
SYNC_ARCHIVE_ROOT: 'core' }
Target directory has a differing lockfile, overwriting.
Download url: https://static.realm.io/downloads/sync/realm-sync-cocoa-3.5.1.tar.gz
Extracting realm-sync-cocoa-3.5.1.tar.gz => ******
{ Error: unexpected end of file
My lock files looks like:
SYNC_SERVER_FOLDER=sync SYNC_ARCHIVE=realm-sync-cocoa-3.5.1.tar.gz SYNC_ARCHIVE_ROOT=core
and is placed in /Users/marty/Documents/Work/01_clients/tupaia/meditrak/node_modules/realm/vendor/realm-ios along with the contents of the core folder from that sync archive.
Does this fix work with realm versions under 3.7?
Only the distribution of Linux binaries changed. Maybe your download speed is too low and you end up with a corrupt file?
http://osxdaily.com/2016/09/22/fix-wi-fi-problems-macos-sierra/ might be useful.
I have updated the documentation (as suggested above), and this issue seems to hit people with a buggy Mac.
I tried @Arabrellaxy 's solution , but find that the script delete the file realm-sync-cocoa-xxx.tar.gz in tmpdir and still try to redownload it.so I check the script 'download-realm.js' and find this related code if (stat.mtime.getTime() !== lastModified.getTime()) in the download method ,since the mtime of my own downloaded file is not the SAME as the network request, so the script still run into the saveFile process, so I just comment out this code temporary to let the build pass.
if someone meet this redownload problem, maybe this comment is useful.
realm-sync-cocoa downloading is very slow in China, I wrote a local file server to speed up downloading. Repo and usage is here.
Hope it helps.
why don't we just download file manually and host it in localhost and make it download every time from localhost?!馃
why don't we just download file manually and host it in localhost and make it download every time from localhost?!馃
Can you show more detail of your way?
@WeijianXu,
in a file node_modules/realm/scripts/download-realm.js
function download(serverFolder, archive, destination) {
- const url = `https://static.realm.io/downloads/${serverFolder}/${archive}`;
+ let url = `https://static.realm.io/downloads/${serverFolder}/${archive}`;
+
+ if (url === 'https://static.realm.io/downloads/sync/realm-sync-cocoa-3.15.0.tar.gz') {
+ url = 'http://localhost/dev/realm/realm-sync-cocoa-3.15.0.tar.gz';
+ }
if you don't understand what - and + means it is git difference.
so, just download the original file and paste it in your localhost. in my case it is /var/www/dev/realm/
Most helpful comment
I happend to experienced this issue today.When I try to run my app from Xcode after installed realm.I got this error as below:
Resolved requirements: { SYNC_SERVER_FOLDER: 'sync', SYNC_ARCHIVE: 'realm-sync-cocoa-3.7.0.tar.gz', SYNC_ARCHIVE_ROOT: 'core' } No lockfile found at the target, proceeding. Download url: https://static.realm.io/downloads/sync/realm-sync-cocoa-3.7.0.tar.gz Extracting realm-sync-cocoa-3.7.0.tar.gz => /Users/xxx/Desktop/xxx/node_modules/realm/vendor/realm-ios { Error: unexpected end of file at Zlib.zlibOnError [as onerror] (zlib.js:142:17) errno: -5, code: 'Z_BUF_ERROR' } Command /bin/sh failed with exit code 1I solved this issue manually based on @kneth 's answer,here are my steps:
First step:
open cmd, locate to your project directory/node_modules/realm/vendor/realm-ios,you will find it is empty馃槉
Second step
vim download-realm.lock,then writeSYNC_SERVER_FOLDER=sync SYNC_ARCHIVE=realm-sync-cocoa-3.7.0.tar.gz SYNC_ARCHIVE_ROOT=coreinto this file.Save and exit.
Remember to change the version number to what you need.
Third step
open another cmd,locate to your downloaded file "realm-sync-cocoa-3.7.0.tar.gz"
excute this command
tar -xzvf realm-sync-cocoa-3.7.0.tar.gz -C yourProjectDirectory/node_modules/realm/vendor/realm-iosFourth step
open the first cmd,you will find the directory is not empty any more.copy all the files under directory "core" and paste them under directory "yourProjectDirectory/node_modules/realm/vendor/realm-ios"
Finally,build and run,you will make it.