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

lambstaller

v0.2.0

Published

Run npm install locally in a Lambda container

Downloads

12

Readme

lambstaller

Current Version Build Status via Travis CI Dependencies

belly-button-style

lambstaller allows you to run npm install --production inside of a Docker container that very closely resembles the AWS Lambda environment. This is useful for installing compiled addons locally, and then deploying to AWS.

Example

The following example copies the file '/path/to/package/to/install/package.json' to the directory '/directory/to/write/files/to/' and then runs npm install --production inside of an AWS Lambda Docker container.

'use strict';
const Lambstaller = require('lambstaller');

Lambstaller({
  out: '/directory/to/write/files/to/',
  pkg: '/path/to/package/to/install/package.json'
}, (err) => {
  // If all went well, err will not exist. The `out` directory will contain a
  // copy of the `pkg` package.json file, and a node_modules directory.
});

API

The function exported by lambstaller has the following specification:

  • Arguments
    • options (object) - A configuration object supporting the following schema.
      • pkg (string) - The path to a package.json file. This file will be the target of npm install --production.
      • out (string) - The directory where the package.json file will be copied and the install will occur.
      • version (string) - Optional string, specifying the version of Node.js to target. Must match a version supported by Lambda. Defaults to 'nodejs4.3'.
    • callback (function) - A function which is called upon completion. This function takes the following arguments.
      • err (error) - Represents any error that occurs.
  • Returns
    • Nothing

Things to be aware of

Because lambstaller runs lambci/lambda:build image in a child process, you must have Docker installed. More information about the image is available here.

The install process is reflected on your local machine by creating a volume. Therefore, Docker must have access to the local install directory. If Docker does not have access, you may see an error similar to this:

Command failed: /bin/sh -c docker run -v "/var/folders/nz/bw4sh4w15bj7_9t2546w3dgh0000gn/T/lambstaller_tests":/var/task lambci/lambda:build npm install --production
docker: Error response from daemon: Mounts denied: mac/osxfs/#namespaces for more info.
.
15bj7_9t2546w3dgh0000gn/T/lambstaller_tests
is not shared from OS X and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> File Sharing.
See https://docs.docker.com/docker-for-.