Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.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
Node.js 20122016 gce windows服务器是否已安装curl?_Node.js_Google Cloud Platform_Google Compute Engine - Fatal编程技术网

Node.js 20122016 gce windows服务器是否已安装curl?

Node.js 20122016 gce windows服务器是否已安装curl?,node.js,google-cloud-platform,google-compute-engine,Node.js,Google Cloud Platform,Google Compute Engine,我正在使用NodeJS和google来启动服务器,我正在运行一个启动脚本 curl”http://eve-robotics.com/release/EveAIO_setup.exe“--输出Eve.exe 日志上写着 2019/12/29 20:27:44 windows启动脚本bat:“curl”不被识别为内部或外部命令,这只发生在2019上的20122016实例上,工作正常,如果我不能对这些实例使用此命令,是否有其他方法从启动脚本下载此文件 更新 这是我正在为启动脚本运行的命令 调用WebR

我正在使用NodeJS和google来启动服务器,我正在运行一个启动脚本
curl”http://eve-robotics.com/release/EveAIO_setup.exe“--输出Eve.exe
日志上写着 2019/12/29 20:27:44 windows启动脚本bat:“curl”不被识别为内部或外部命令,这只发生在2019上的20122016实例上,工作正常,如果我不能对这些实例使用此命令,是否有其他方法从启动脚本下载此文件

更新 这是我正在为启动脚本运行的命令
调用WebRequest-Uri”http://eve-robotics.com/release/EveAIO_setup.exe-Headers@{“升级不安全请求”=“1”;“用户代理”=“Mozilla/5.0(Windows NT 10.0;Win64;x64)AppleWebKit/537.36(KHTML,如Gecko)Chrome/79.0.3945.88 Safari/537.36”;“接受”=“text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed exchange;v=b3;q=0.9”;“接受编码”=“gzip,deflate”;“接受语言”=“en-US,en;q=0.9”;”-OutFile plz.exe
,当它运行完后,正如我在实例日志中看到的那样,我连接到它,当我尝试运行plz.exe时,我得到的错误是“系统找不到指定的文件”

更新现在我在传递完整路径后出现此错误

2019/12/30 21:36:20 windows-startup-script-ps1:调用WebRequest:路径中的非法字符。 2019/12/30 21:36:20 windows-startup-script-ps1:At C:\windows\TEMP\metadata-scripts903292515\windows-startup-script-ps1.ps1:1 2019/12/30 21:36:20 windows-startup-script-ps1:char:1 2019/12/30 21:36:20 windows-startup-script-ps1:+调用WebRequest-Uri“。。。 2019/12/30 21:36:21 windows-startup-script-ps1:+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2019/12/30 21:36:21 windows-startup-script-ps1:+CategoryInfo:NotSpecified:(:)[Invoke WebRequest],ArgumentE 2019/12/30 21:36:21 windows-startup-script-ps1:异常 2019/12/30 21:36:21 windows-startup-script-ps1:+FullyQualifiedErrorId:System.ArgumentException,Microsoft.PowerShell.Co 2019/12/30 21:36:21 windows-startup-script-ps1:mmands.InvokeWebRequestCommand

这是我正在使用的命令


调用WebRequest-Uri”http://eve-robotics.com/release/EveAIO_setup.exe-Headers@{“升级不安全请求”=“1”;“用户代理”=“Mozilla/5.0(Windows NT 10.0;Win64;x64)AppleWebKit/537.36(KHTML,如Gecko)Chrome/79.0.3945.88 Safari/537.36”;“接受”=“text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed exchange;v=b3;q=0.9”;“接受编码”=“gzip,deflate”;“接受语言”=“en-US,en;q=0.9”;”-OutFile C:\Users\browardboybrian\Desktop\plz.exe

如果您已经在运行节点服务器脚本,服务器可以通过http获取文件并将其保存为
Eve.exe

这里有一个来自中国的例子


不要使用
curl
使用PowerShell
Invoke WebRequest
。我试过了,但它不是wokring,它说在我使用-OutFile Eve.exe时找不到指定的文件。是否要将Eve exe文件下载到启动VM的文件夹中并执行它?只是这样吗?您在
Invoke Web中使用的确切行是什么请求
?确切的错误消息是什么?请将此信息添加到问题中。如果您是从启动脚本执行程序,则应使用完整路径名。您使用的是相对路径。对于powershell命令,为什么要添加所有这些头?这不是您的问题,但不是必需的。除非调用WebRequest rep如果出现错误,您的问题是没有指定下载和程序启动的完整路径。他使用node启动机器,而不是在机器上运行。
// Dependencies
var fs = require('fs');
var url = require('url');
var http = require('http');
var exec = require('child_process').exec;

// App variables
var file_url = 'http://upload.wikimedia.org/wikipedia/commons/4/4f/Big%26Small_edit_1.jpg';
var DOWNLOAD_DIR = './downloads/';

// We will be downloading the files to a directory, so make sure it's there
// This step is not required if you have manually created the directory
var mkdir = 'mkdir -p ' + DOWNLOAD_DIR;
var child = exec(mkdir, function(err, stdout, stderr) {
  if (err) throw err;
  else download_file_httpget(file_url);
});

// Function for downloading file using HTTP.get
var download_file_httpget = function(file_url) {
  var options = {
    host: url.parse(file_url).host,
    port: 80,
    path: url.parse(file_url).pathname
  };

  var file_name = url.parse(file_url).pathname.split('/').pop();
  var file = fs.createWriteStream(DOWNLOAD_DIR + file_name);

  http.get(options, function(res) {
    res.on('data', function(data) {
      file.write(data);
    }).on('end', function() {
      file.end();
      console.log(file_name + ' downloaded to ' + DOWNLOAD_DIR);
    });
  });
};