Node.JS script does not work

19 views
Skip to first unread message

Ishwara Bhat

unread,
Jan 19, 2018, 12:15:21 PM1/19/18
to gce-discussion
Hi,
I am trying to use node.js script to start and stop VM.

var projectId = 'iknowitmoms';
var gcloud = require('gcloud')({ projectId: projectId });
var gce = gcloud.compute();
var zone = gce.zone('us-central1-f');

I run from windows 8.1
It gives error - can not find module 'gcloud'.

Before this, I had done 
d:\> node --version
It returned  "v8.9.4

I had installed d:\> npm install -g gcloud

After installation, I tried the node.js. the it gave error I mentioned - can not find module 'gcloud'.

I had noticed that npm documentation says the name changed to google-cloud. I tried this also.
It does not work.

Any suggestions? Thanks.


Carlos (Cloud Platform Support)

unread,
Jan 19, 2018, 3:22:59 PM1/19/18
to gce-discussion
Hi Ishwara,

I found some links containing code samples for GCP products that might help you. Particularly this one is focused in GCE and use the client library to create a VM.



Reply all
Reply to author
Forward
0 new messages