npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

offline-npm

v0.2.2

Published

npm pack for offline installation

Downloads

255

Readme

offline-npm

npm >= v3.x bundled with node >= v5 has broken this project.
preinstall script is since then called after requests to npm registry are made.
This makes it impossible for offline-npm to start as a registry server.
See BROKEN.md for detailed logs.

Hassle-free npm pack including all dependencies for offline installation with npm install

Add offline-npm to your project to serve a npm compatible tgz file wich contains all dependencies for offline installation with npm install.

Additionally you can use offline-npm -n to install packages from your local npm cache directory (Could be useful e.g. on travelling).

Even installs using git: or file: (requires node>=0.11) are considered.

Table of Contents

Installation

npm install -g offline-npm

Usage

  1. Open terminal and go to your project you want to prepare for offline use. This folder needs to contain a package.json file.

  2. Prepare your project for offline use

     offline-npm --add

    This changes the package.json file and adds a offline folder which will contain all your dependencies.

  3. Pack your project

     npm pack

    Now the local cache is changed and all your projects dependencies will be downloaded into offline/cache and packed into the npm tgz file.

    Note: Take care not to add a global *.tgz into your .npmignore file!

    Note: An existing npm-shrinkwrap.json file will get overwritten in this step to provide install without the --registry switch. A backup is stored in the ./offline folder.

  4. Transfer the resulting <name>-<version>.tgz from the pack command onto a machine with no connectivity to the required registry. Execute this line from a terminal.

    Now install the package with:

     npm install [-g] <name>-<version>.tgz

Tutorial

Find here a step-by-step tutorial using a provided sample project.

Install packages from npm cache offline

If you want to use your local npm cache to install packages from use the option

offline-npm -n [-d]

-d shows you some server logs on the console.

Then install packages from the local npm cache with:

npm --registry http://localhost:4873 [-f] install <packagename>

Use the -f switch to force installing packages. This might be required if npm stops stating "shasum" errors.

Troubleshooting

  1. Never add *.tgz into your .npmignore file. Otherwise all package.tgz files for the offline installation will be missing.

    If you want to exclude previously packed versions of the package you're working with use <name>-*.tgz instead.

  2. The script needs access to npm. It is assumed that npm is installed alongside with node. If you experience problems with correcty resolving npm, add to your $HOME/.profile or $HOME/.bashrc

     export NODE_PATH=<path_to_node_modules>/node_modules:$NODE_PATH

    where <path_to_node_modules> is the path to the node_modules dir which contains npm.

  3. If installation hangs try installing in verbose mode

     `npm install <name-version>.tgz --verbose`

    If you see that some .lock in your files block you from progress, consider deleting them with npm cache clean <pkg>[@<version>]

License

Copyright (c) 2014 commenthol

Software is released under MIT.