Reputation: 5893
My project references mocha
, phantomjs
, etc, which takes a lot of time to download during npm install
. This is not a problem in my local machine because I only download them once and can use them forever unless I decide to manually upgrade them.
However, in my CI
machine, my jenkins
server need to download them every time that I did a git commit
and git push
to do the testing and deploy.
So can I just speed up that process by set the npm not to download these slow packages from the remote server? Rather, install them from local cache or not to install them if I installed them globally?
Anyone knows how to configure that?
Upvotes: 0
Views: 155
Reputation: 4876
I found some packages that might be helpful
npm install
only if the contents of package.json
's devDependencies
and dependencies
were changed, note that it assumes that node_modules
persists across different builds which might not be helpful if your CI server always start from scratchnpm install
and then copies your current node_modules
folder (to somewhere in \tmp
), if you call the script again it will verify any changes to package.json (instead of changes done on devDependencies
or dependencies
), if it didn't change then it will copy the node_modules
folder stored in \tmp
, the only limitation I see is that it's not cross platform and that the cache folder is \tmp
which is erased on reboot (or maybe even when a is process finished!)The second package might not work as it is but it seems like a good place to start :)
Upvotes: 1
Reputation: 1204
You can specify all of the packages you want to use locally in devDependencies
in package.json, and then running npm install -d
will install those instead of the main dependencies.
Upvotes: 0