Sorry, partial answer here, in "bad" English.

But you cannot do:

require('express');

only having installed global Express. You must install express as local
module in your current app.

You must run

npm install express

in your project top folder (where the server.js resides).

Or you add express as dependency in your package.json, and run

npm install

It is a nuance that global and local modules are different, in general. But
it has a justification: global installation module are for install and use
global commands, as:

express create ....

(Sorry, I don't remember now the exact form, check express site)

And

require('express')

DOES NOT look for a global express.

C'est la vie ;-)

Angel "Java" Lopez
@ajlopez



On Sun, Feb 9, 2014 at 2:58 PM, David Karr <davidmichaelk...@gmail.com>wrote:

> I'm working on a small webapp that normally is built with a relatively
> complex process and then deployed to WebLogic.
>
> However, the portion I'm working on is using AngularJS, and is all HTML
> and Javascript.  It normally makes ajax calls into another webapp on the
> same domain.  To shorten my development cycle, I'd like to avoid a build
> process and just reload the browser page.
>
> I think I can do this with some combination of nodejs.  It's easy enough
> to have it run a plain web server serving the contents of any folder, but I
> need to be able to configure it to reroute some requests to another domain.
>
> I get the feeling that I can do this with "express", but I'm having
> trouble figuring it out. After I installed express globally with npm, I
> tried just running "node server.js", where "server.js" had a
> "require('express')".  This just fails with "Error: Cannot find module
> 'express'".  Then I tried storing a "package.json" in the current directory
> that specifies "express" as a dependency and then trying "node server.js"
> again, but I got the same error.
>
> --
> --
> 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 nodejs@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nodejs+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
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 nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to