ahsteele
ahsteele

Reputation: 26494

Why does Cloud9 IDE return the error "Script does not exist" when trying to run simple Node.js script?

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:

image of run configuration

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

Answers (2)

Jan Jongboom
Jan Jongboom

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:

  • Either wait
  • Create a new project with the same file, chances are that it'll run

Upvotes: 1

Bill
Bill

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

Related Questions