Please have a look :
C:\PROGRAM FILES\NODEJS\NODE_MODULES
└───npm
├───bin
│ └───node-gyp-bin
├───doc
│ ├───api
│ └───cli
├───html
│ ├───api
│ └───doc
├───lib
│ └───utils
│ ├───completion
│ └───npm-registry-client
├───man
│ ├───man1
│ └───man3
├───node_modules
│ ├───abbrev
│ │ └───lib
│ ├───archy
│ ├───block-stream
│ ├───chownr
│ ├───fstream
│ │ └───lib
│ ├───fstream-npm
│ │ └───node_modules
│ │ └───fstream-ignore
│ ├───graceful-fs
│ ├───inherits
│ ├───ini
│ ├───lru-cache
│ │ └───lib
│ ├───minimatch
│ ├───mkdirp
│ ├───node-gyp
│ │ ├───bin
│ │ ├───legacy
│ │ │ └───tools
│ │ │ └───gyp
│ │ │ ├───buildbot
│ │ │ ├───pylib
│ │ │ │ └───gyp
│ │ │ │ └───generator
│ │ │ ├───samples
│ │ │ └───tools
│ │ │ └───Xcode
│ │ │ └───Specifications
│ │ ├───lib
│ │ │ └───util
│ │ └───node_modules
│ │ ├───ansi
│ │ │ └───lib
│ │ └───glob
│ ├───node-uuid
│ ├───nopt
│ │ ├───bin
│ │ └───lib
│ ├───proto-list
│ ├───read
│ │ └───lib
│ ├───request
│ │ └───vendor
│ │ └───cookie
│ ├───rimraf
│ ├───semver
│ │ └───bin
│ ├───slide
│ │ └───lib
│ ├───tar
│ │ └───lib
│ ├───uid-number
│ └───which
│ └───bin
├───scripts
└───test
└───packages
├───npm-test-blerg
├───npm-test-bundled-git
├───npm-test-env-reader
├───npm-test-files
│ └───sub
├───npm-test-ignore
│ └───sub
├───npm-test-missing-bindir
├───npm-test-optional-deps
├───npm-test-platform
├───npm-test-platform-all
├───npm-test-private
├───npm-test-shrinkwrap
├───npm-test-test-package
└───npm-test-url-dep
C:\Program Files\nodejs>
Thanks in advnace.
I wanna execute the following file :
var http = require('http');
var multipart = require('multipart');
var sys = require('sys');
var server = http.createServer(function(req, res) {
switch (req.uri.path) {
case '/':
display_form(req, res);
break;
case '/upload':
upload_file(req, res);
break;
default:
show_404(req, res);
break;
}
});
server.listen(8000);
function display_form(req, res) {
res.sendHeader(200, {'Content-Type': 'text/html'});
res.sendBody(
'<form action="/upload" method="post" enctype="multipart/form-
data">'+
'<input type="file" name="upload-file">'+
'<input type="submit" value="Upload">'+
'</form>'
);
res.finish();
}
function upload_file(req, res) {
req.setBodyEncoding('binary');
var stream = new multipart.Stream(req);
stream.addListener('part', function(part) {
part.addListener('body', function(chunk) {
var progress = (stream.bytesReceived / stream.bytesTotal *
100).toFixed(2);
var mb = (stream.bytesTotal / 1024 / 1024).toFixed(1);
sys.print("Uploading "+mb+"mb ("+progress+"%)\015");
// chunk could be appended to a file if the uploaded file needs
to be saved
});
});
stream.addListener('complete', function() {
res.sendHeader(200, {'Content-Type': 'text/plain'});
res.sendBody('Thanks for playing!');
res.finish();
sys.puts("\n=> Done");
});
}
function show_404(req, res) {
res.sendHeader(404, {'Content-Type': 'text/plain'});
res.sendBody('You r doing it rong!');
res.finish();
}
Please suggest how can I execute this js!
Thanks in advance.
My classpath : C:\Program Files\Java\jdk1.6.0_21\bin;C:\Program Files
\nodejs\
On Jun 4, 3:13 pm, Angel Java Lopez <[email protected]> wrote:
> Hmmm.. it's rare..
>
> Can you share with us the output of
>
> tree node_modules
>
> from your working directory? It could be large, but is the only idea I have.
>
> Your PATH should point to
> c:\Program Files\nodejs
>
> Every day, I run node in Windows Vista, Windows Server 2008, Windows 7,
> without major glitches
>
> Any other ideas?
>
>
>
>
>
>
>
> On Mon, Jun 4, 2012 at 7:00 AM, Ronnie <[email protected]> wrote:
> > Thanks .
>
> > I ran the msi , for which the node js got installed in C:\Program Files
> > \nodejs\node_modules\npm.
>
> > PATH is also set . I can run the hellowrld programes but whihle
> > running the following program :
>
> > var express = require('express');
>
> > var app = express.createServer(express.logger());
>
> > app.put('/', function(req, res) {
> > res.contentType('json');
> > res.send(JSON.stringify({ status: "success" }));
> > });
>
> > var port = process.env.PORT || 3000;
>
> > app.listen(port, function() {
> > console.log("Listening on " + port);
> > });
>
> > I get the following errors.
>
> > module.js:337
> > throw new Error("Cannot find module '" + request + "'");
> > ^
> > Error: Cannot find module 'express'
> > at Function._resolveFilename (module.js:337:11)
> > at Function._load (module.js:279:25)
> > at Module.require (module.js:359:17)
> > at require (module.js:375:17)
> > at Object.<anonymous> (C:\node1.js:1:77)
> > at Module._compile (module.js:446:26)
> > at Object..js (module.js:464:10)
> > at Module.load (module.js:353:31)
> > at Function._load (module.js:311:12)
> > at Array.0 (module.js:484:10)
>
> > I have been given the suggestion to run npm install to include all the
> > modules , but modules are already there !
>
> > What should i DO?
>
> > On Jun 4, 2:30 pm, Angel Java Lopez <[email protected]> wrote:
> > > One comment:
>
> > > Ronnie, I'm an old programmer, I used to program in mainframes, punched
> > > cards, minicomputers, some old Unix, even Xenix ;-)... but the last two
> > > decades, my career was in Windows.
>
> > > One thing a Windows developer like me, found a bit not explicit stated
> > > (maybe I wrong, but...) is that npm can be (and usually is) invoked AT A
> > > WORKING FOLDER. Your .msi installation should add the node path to your
> > > PATH. If not, I highly recommended to add it.
>
> > > Then, you can enter:
>
> > > cd \myusualdevfolder
> > > mkdir mytest
> > > cd mytest
> > > npm install nodeunit
>
> > > then, in your mytest folder, you will have a node_modules folder, with
> > > nodeunit subfolder.
>
> > > Can you run npm in this way, and install something not in your system,
> > like
> > > nodeunit?
>
> > > (or try npm install simplemvc (my project ;-))
>
> > > I see that you are trying to run
>
> > > npm install ....
>
> > > from the npm directory. Hmmm... It's not the usual way.
>
> > > Please, can you do the above steps? have node installation folder in your
> > > PATH?
>
> > > Angel "Java" Lopezhttp://www.ajlopez.comhttp://twitter.com/ajlopez
>
> > > On Mon, Jun 4, 2012 at 6:19 AM, Srirangan <[email protected]> wrote:
> > > > I see this occasionally on Ubuntu. Just re-run the command.
>
> > > > Srirangan | +91 9711 477 595 | About <http://srirangan.net/about>
> > > > GitHub <https://github.com/Srirangan> LinkedIn<
> >http://www.linkedin.com/in/srirangan>
> > > > Twitter <http://twitter.com/srirangan> | Review19<
> >http://review19.com> "Collaborate
> > > > & Track Decisions"
>
> > > > On Mon, Jun 4, 2012 at 2:48 PM, Ronnie <[email protected]> wrote:
>
> > > >> I ran the npm install commnad and got the following exception:
>
> > > >> npm http GEThttps://github.com/isaacs/ronnjs/tarball/master
> > > >> npm ERR! failed to fetchhttps://
> > github.com/isaacs/ronnjs/tarball/master
>
> > > >> npm ERR! Error: getaddrinfo ENOENT
> > > >> npm ERR! at errnoException (dns.js:31:11)
> > > >> npm ERR! at Object.onanswer [as oncomplete] (dns.js:140:16)
> > > >> npm ERR! You may report this log at:
> > > >> npm ERR! <http://github.com/isaacs/npm/issues>
> > > >> npm ERR! or email it to:
> > > >> npm ERR! <[email protected]>
> > > >> npm ERR!
> > > >> npm ERR! System Windows_NT 5.1.2600
> > > >> npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program
> > > >> Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "instal
> > > >> npm ERR! cwd C:\Program Files\nodejs\node_modules\npm
> > > >> npm ERR! node -v v0.6.18
> > > >> npm ERR! npm -v 1.1.21
> > > >> npm ERR! syscall getaddrinfo
> > > >> npm ERR! code ENOTFOUND
> > > >> npm ERR! message getaddrinfo ENOENT
> > > >> npm ERR! errno {}
> > > >> npm ERR!
> > > >> npm ERR! Additional logging details can be found in:
> > > >> npm ERR! C:\Program Files\nodejs\node_modules\npm\npm-debug.log
> > > >> npm not ok
>
> > > >> What is the problem?
>
> > > >> Please help on this regard!
>
> > > >> On Jun 4, 1:28 pm, Ronnie <[email protected]> wrote:
> > > >> > Thanks , can you guide me on this.
>
> > > >> > I have installednode-v0.6.18.msi exe and thenodehas been installed
> > > >> > in
>
> > > >> > C:\Program Files\nodejs .
>
> > > >> > What next ?
>
> > > >> > How to run the npm install command?
>
> > > >> > Plese guide.
>
> > > >> > Hello world is running.
>
> > > >> > On Jun 4, 1:19 pm, yogesh agrawal <[email protected]> wrote:
>
> > > >> > > multipart module is not in node_modules.
>
> > > >> > > install it by using npm install command
>
> > > >> > > On Mon, Jun 4, 2012 at 1:46 PM, Ronnie <[email protected]> wrote:
> > > >> > > > Hi,
>
> > > >> > > > I am successfull in running the hello world app.
>
> > > >> > > > Now I am trying to run some other app and getting the following
> > > >> > > > error .
>
> > > >> > > > module.js:337
> > > >> > > > thrownewError("Cannot find module '" + request + "'");
> > > >> > > > ^
> > > >> > > > Error: Cannot find module 'multipart'
> > > >> > > > at Function._resolveFilename (module.js:337:11)
> > > >> > > > at Function._load (module.js:279:25)
> > > >> > > > at Module.require (module.js:359:17)
> > > >> > > > at require (module.js:375:17)
> > > >> > > > at Object.<anonymous> (C:\upload.js:2:17)
> > > >> > > > at Module._compile (module.js:446:26)
> > > >> > > > at Object..js (module.js:464:10)
> > > >> > > > at Module.load (module.js:353:31)
> > > >> > > > at Function._load (module.js:311:12)
> > > >> > > > at Array.0 (module.js:484:10)
>
> > > >> > > > Please help in this regard!
>
> > > >> > > > Thanks in advance.
>
> > > >> > > > On Jun 4, 11:49 am, Ronnie <[email protected]> wrote:
> > > >> > > > > Hi ,
> > > >> > > > > I am verynewinnodejs . I have installednode-v0.6.18.msi in my
> > > >> > > > > local windows machine.
>
> > > >> > > > > I am unabl eto run a hello world program.
>
> > > >> > > > > Could you please help me in this respect!
>
> > > >> > > > > Thanks in advance.
>
> > > >> > > > --
> > > >> > > > Job Board:http://jobs.nodejs.org/
> > > >> > > > Posting guidelines:
>
> >https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> > > >> > > > You received this message because you are subscribed to the
> > Google
> > > >> > > > Groups "nodejs" group.
> > > >> > > > To post to this group, send email to [email protected]
> > > >> > > > To unsubscribe from this group, send email to
> > > >> > > > [email protected]
> > > >> > > > For more options, visit this group at
> > > >> > > >http://groups.google.com/group/nodejs?hl=en?hl=en
>
> > > >> > > --
> > > >> > > Yogesh Agrawal
> > > >> > > +91-9351507770
>
> > > >> --
> > > >> Job Board:http://jobs.nodejs.org/
> > > >> Posting guidelines:
> > > >>https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> > > >> You received this message because you are subscribed to the Google
> > > >> Groups "nodejs" group.
> > > >> To post to this group, send email to [email protected]
> > > >> To unsubscribe from this group, send email to
> > > >> [email protected]
> > > >> For more options, visit this group at
> > > >>http://groups.google.com/group/nodejs?hl=en?hl=en
>
> > > > --
> > > > Job Board:http://jobs.nodejs.org/
> > > > Posting guidelines:
> > > >https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> > > > You received this message because you are subscribed to the Google
> > > > Groups "nodejs" group.
> > > > To post to this group, send email to [email protected]
> > > > To unsubscribe from this group, send email to
> > > > [email protected]
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/nodejs?hl=en?hl=en
>
> > --
> > Job Board:http://jobs.nodejs.org/
> > Posting guidelines:
> >https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> > You received this message because you are subscribed to the Google
> > Groups "nodejs" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]
> > For more options, visit this group at
> >http://groups.google.com/group/nodejs?hl=en?hl=en
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en