Using Meteor Offline
Tips and tricks to workaround package management offline.
Most modern web frameworks use package managers. It's almost unavoidable when building larger projects or projects that use modern concepts or components. They allow for easier development where dependency trees are managed along with versions and updates. Unless of course you're working offline. Then they're a pain in the arse.
A lot of package managers allow you to download a mirror of the central repository for offline dependency management, such as npm. And despite npm being encompassed within Meteor, the Meteor framework doesn't allow for an offline mirror. At least not cleanly. I've recently been required to use Meteor in an offline environment with no access to the Internet, so my Meteor journey stopped and started at
meteor add <package>. Errors. Errors everywhere. "Are you behind a proxy?", "Are you offline?", "Cannot connect". It took a little while to figure out but here is how I install packages and their dependencies to a Meteor project that has no access to the Internet.
What you need
- An online machine with the Meteor framework installed
- A removable storage device
What to do
On your machine with online access and the Meteor framework installed, take an existing project or create a new meteor project:
meteor create sample-app
Add the package (and implicit dependencies) that you want to add to your offline project. For example d3.js
meteor add d3js:d3
At this point you need to head over to your Meteor installation directory e.g.
C:/Users/smittey/AppData/Local/.meteor/packagesand select the newly added packages (hint: sort by date descending to see most recently added). Take these packages and copy them to your removable storage device.
Make a note of the dependency additions to
Move the removable storage device to your offline machine and copy the packages into your local
importsfolder in root of your project i.e.
<project>/importsand copy in those same dependencies.
Take your packages file at
<project>/.meteor/packagesand add in the dependencies noted from step 4.
meteorand you should be good to go. The dependencies should be installed and final ties to the project should be created correctly.
Happy dependency managing!