Reputation: 26494
I am attempting to create a simple Hello World Node.js script using Cloud9 IDE. My code is below and is the atypical 6 lines:
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(process.env.PORT);
I don't see any errors and the IDE is certainly not alerting me to any. I've ensured that the file is saved (even going so far as to commit it to my repo). Unfortunately, whenever I try to run the above code I receive the following error:
Error on server
Received following error from server:
"Script does not exist: server.js"
To illustrate the run configuration I've included the below screenshot:
I am pretty sure I am missing something obvious, but whatever it is its alluding me. What do I have misconfigured that could cause my server.js file to not run?
Upvotes: 0
Views: 500
Reputation: 27323
Your configuration is correct, there is however a temporarily problem that causes some of the VM's to not run a file. I've seen it before and it usually goes away after some time. Quick fixes now:
Upvotes: 1
Reputation: 25555
Your filepath doesn't look right. Shouldn't it be server.js
and not /server.js
? Try creating a new run configuration and set the file path to server.js
.
Upvotes: 0