Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CentOs:无法使用curl提取下载的tar_Curl_Centos_Gzip_Tar_Ls - Fatal编程技术网

CentOs:无法使用curl提取下载的tar

CentOs:无法使用curl提取下载的tar,curl,centos,gzip,tar,ls,Curl,Centos,Gzip,Tar,Ls,我正在尝试使用curl下载节点: $> curl https://nodejs.org/dist/latest/node-v6.6.0.tar.xz | tar xz -C /opt 现在,在我的Mac电脑上,这是可行的。但是,在CentOs中,这不起作用: $> curl https://nodejs.org/dist/latest/node-v6.6.0.tar.xz | tar xz -C /opt % Total % Received % Xferd Averag

我正在尝试使用curl下载
节点

$>  curl https://nodejs.org/dist/latest/node-v6.6.0.tar.xz | tar xz -C /opt
现在,在我的Mac电脑上,这是可行的。但是,在CentOs中,这不起作用:

$> curl https://nodejs.org/dist/latest/node-v6.6.0.tar.xz | tar xz -C /opt
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                             Dload  Upload   Total   Spent    Left  Speed
  0 14.8M    0   941    0     0   1214      0  3:33:54 --:--:--  3:33:54  1214
gzip: stdin: not in gzip format
tar: Child died with signal 13
tar: Error is not recoverable: exiting now
0 14.8M    0 42083    0     0  51628      0  0:05:01 --:--:--  0:05:01 51635
curl: (23) Failed writing body (246 != 1369)
我不明白这里到底发生了什么

如果我拆分命令并执行

$> curl https://nodejs.org/dist/latest/node-v6.6.0.tar.xz > node.tgz
$> tar -xvf node.tgz // NOTE that I omitted the `z`
它起作用了。基于此,也许curl已经解压了我尝试过的文件

$> curl https://nodejs.org/dist/latest/node-v6.6.0.tar.xz | tar x -C /opt
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                             Dload  Upload   Total   Spent    Left  Speed
0 14.8M    0   941    0     0   1005      0  4:18:23 --:--:--  4:18:23  1004tar: Archive is compressed. Use -J option
tar: Error is not recoverable: exiting now
0 14.8M    0 17325    0     0  18258      0  0:14:13 --:--:--  0:14:13 18256
curl: (23) Failed writing body (428 != 1369)
否:(如果您使用tar应用程序等待.gz(gunzip)格式中的“-z”选项,我们将不胜感激

您应该使用选项“J”:


Thnx的解释。你知道为什么它在Mac上工作吗?Mac使用libarchive bsdtar,它会自动检测压缩格式。
curl https://nodejs.org/dist/latest/node-v6.6.0.tar.xz | tar xJ -C /tmp