node.js - node.exe does not read file, but returns ellipsis (...) -


end feb 2014 downloaded node c:\dev\0.10\ of windows 7 machine, , node.exe opens fine. inspired smashing node (some book), want achieve following:

firefox shows plain text smashing node! if point localhost:3000 , run in node console

node my-web-server.js  

where my-web-server.js file next node.exe contains

require('http').createserver(function(req,res){res.writehead(200, ('content-type', 'text/html'));res.end('<marquee>smashing node!</marquee>');}).listen(3000);; 

but fail: browser says

cannot connect webserver on localhost:3000. 

if paste above oneliner in node reacts with

{ domain: null,   _events: ..etc...  } 

ignoring that, browser f5 results in smashing node!.

node refuses simplest of files, have file called hello.js next node.exe , file contains ascii text console.log("hello"); type:

node hello.js 

node returns

...  

(an ellipsis in dark gray) expected was: node returns hello

i type file not exist this:

node die 

node returns

... 

if type

var http = require('http'); 

node:

undefined  

(in darkish gray) expected was: ok, since above oneliner resulted in web server.

if type

npm install colors  

node reacts

npm should run outside of node repl, in normal shell. (press control-d exit.) 

of course

node --version  

also responds ellipsis.

what can do? how make node process files?

you need run node hello.js (and npm) on command line shell (e.g. cmd.com or windows powershell).

you trying run in node repl (node console), expected type javascript.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -