Is there a way to install express without using NPM?

1,181 views
Skip to first unread message

Anthony Kong

unread,
Nov 16, 2011, 3:35:44 PM11/16/11
to expre...@googlegroups.com
I'm just curious.  I thought I could reference express by requiring the relative directory, but no go:

var express = require("./node_modules/express");

Any ideas?

Thanks.

TJ Holowaychuk

unread,
Nov 16, 2011, 3:37:32 PM11/16/11
to expre...@googlegroups.com
you can use NODE_PATH, it's basically PATH.. but for node :D haha

-- 
TJ Holowaychuk
--
You received this message because you are subscribed to the Google Groups "Express" group.
To post to this group, send email to expre...@googlegroups.com.
To unsubscribe from this group, send email to express-js+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/express-js?hl=en.

Anthony Kong

unread,
Nov 16, 2011, 3:53:39 PM11/16/11
to expre...@googlegroups.com
Sorry, I'm kind of a noob.  Do you mean set my NODE_PATH in my bash profile?

Or am I somehow able to use NODE_PATH programmatically in my app?

Alex Katebi

unread,
Nov 16, 2011, 9:37:40 PM11/16/11
to expre...@googlegroups.com
Yes. Just git clone the express. Then go to the examples.
Don't forget to set the git tag: git checkout 2.5.0
You will see how it is done in the examples.

--

Anthony Kong

unread,
Nov 17, 2011, 12:57:40 AM11/17/11
to expre...@googlegroups.com
Thanks.

I just tried to run the helloworld example and it gave me an error.

node.js:134
        throw e; // process.nextTick error, or 'error' event on first tick
        ^
Error: Cannot find module 'connect'
    at Function._resolveFilename (module.js:320:11)
    at Function._load (module.js:266:25)
    at require (module.js:348:19)
    at Object.<anonymous> (/Users/Kong_iMac/workspace-node/express/lib/express.js:13:15)
    at Module._compile (module.js:404:26)
    at Object..js (module.js:410:10)
    at Module.load (module.js:336:31)
    at Function._load (module.js:297:12)
    at require (module.js:348:19)
    at Object.<anonymous> (/Users/Kong_iMac/workspace-node/express/examples/helloworld/app.js:6:15)

I have a feeling that if I did npm install -d this would run fine.  I'm guessing that npm does some global magic that makes everything work nicely?

Something to do with the node_modules folder in /usr/local/lib ?

Thanks again.

Alex Katebi

unread,
Nov 17, 2011, 10:30:10 AM11/17/11
to expre...@googlegroups.com
First make sure that you have the latest stable node which is v0.4.12 do "node -v"
Then clone the express git. Then do "git branch -r" then do "git branch origin/2.x"
Then do "npm install -d" 

Now you should be able to go to the example directory and run the helloworld without any problems.

Anthony Kong

unread,
Nov 17, 2011, 10:56:42 AM11/17/11
to expre...@googlegroups.com
Yeah, I'm certain that if I run npm install -d, it will work.

But the whole point of this exercise is to avoid using npm.  I guess the broader question could be "how does npm link node modules (such as express) with node"?

vision media [ Tj Holowaychuk ]

unread,
Nov 17, 2011, 11:03:49 AM11/17/11
to expre...@googlegroups.com
that's the point of a package manager really, otherwise you have to look at package.json, find all the deps, add them all in manually etc
Tj Holowaychuk
Vision Media
President & Creative Lead
Reply all
Reply to author
Forward
0 new messages