How do I install node packages on an offline machine?
For instance, I am trying to install PhantomCSS onto a machine with no internet connectivity.
Using an automated package boxing tool like npmbox is preferred, because even though it can be done with npm alone, all dependencies must be carefully downloaded and installed. npmbox does the hard work for you. Perform npmbox phantomcss
on a computer with an internet connection, take the resulting package to your offline computer via another means (such as a pen drive), then install the package with npmunbox phantomcss.npmbox
.
Here is the alternative that I wrote before. I had chosen to follow this piece of advice for the answer.
Running npm view phantomcss
will give you something like this at the end of the output:
dist:
{ shasum: '5a6cacc60934daed76031cf372a76aff240ba117',
tarball: 'http://registry.npmjs.org/phantomcss/-/phantomcss-0.9.1.tgz' },
directories: {} }
Download the tarball on a computer with an internet connection. Transfer it to your offline computer, then install the package with npm install
:
npm install /directory/to/your/package/phantomcss-0.9.1.tgz
Just appending what the other answer mentions: all other dependencies must be installed manually before doing this.