Install without build ?

Showing 1-6 of 6 messages
Install without build ? Tom 3/29/11 10:42 PM
I'm trying to create source code bundles of node and a defined set of
modules, and I'd like to use npm to add/update modules for that.
However npm install will build the module which in the case of modules
with native code (such as expresso) will also build that native code
which I'd like to avoid. Is there a way to splat modules with npm into
the node_modules folder without building them ?

cheers,
Tom
Re: [npm] Install without build ? Isaac Z. Schlueter 3/31/11 3:33 PM
The simplest way to get this today is to just pull stuff out of the
cache folder (which is the plumbing command that npm install uses.)

    npm cache add expresso

That will add the latest version of expresso to the cache folder.  In
npm 1.0, that folder is ~/.npm.  In the 0.x versions, it's found in
$(npm config get root)/.npm/.cache.  `npm cache ls` will show show you
what's in there.  Feel free to move or copy stuff out.

It'd be pretty easy to add a `npm cache unpack foo /some/folder`
command, so that you could do an add-and-splat functionality.  If that
sounds like something you'd like, please post an issue.

Basically, `install` is just cache.unpack()+build().  So, I think a
`npm install --no-build` would be a bit weird, since this use case
isn't very common.  Maybe if more people asked for it, it'd be worth
adding some sugar around.

Re: [npm] Install without build ? Thomas Dudziak 3/31/11 11:07 PM
I was thinking a little bit more about that, and I really only need
something like

npm download expresso

that downloads something (user-defined folder ?) that

npm install ...

later then can install.

"npm cache add" seems close enough for my purposes, I'm gonna try it out.
Thanks !

Tom

Re: [npm] Install without build ? Isaac Z. Schlueter 4/1/11 12:47 AM
Btw: npm can install local tarballs quite easily.  So, you could do:

npm cache add {pkg}@{version}
cp {npm.cache}/{pkg}/{version}/package.tgz ./packages/{pkg}-{version}.tgz

or something.

Re: [npm] Install without build ? Thomas Dudziak 4/2/11 5:41 PM
npm config set cache "$WORK_DIR"
npm cache clean $PACKAGE
npm cache add $PACKAGE

Works beautifully, thx !

Tom

Re: [npm] Install without build ? Isaac Z. Schlueter 4/2/11 5:54 PM
On Sat, Apr 2, 2011 at 17:41, Thomas Dudziak <tom...@gmail.com> wrote:
> npm config set cache "$WORK_DIR"
> npm cache clean $PACKAGE
> npm cache add $PACKAGE

Btw, if you're doing this as part of a shell script or something, and
you don't want to permanently change npm's behavior, you can also put
it in the env for just that script.

#!/bin/bash
export npm_config_cache="$WORK_DIR"


npm cache clean $PACKAGE
npm cache add $PACKAGE