Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save marcuslilja/76fd22c0b45c9830cb2c to your computer and use it in GitHub Desktop.
Save marcuslilja/76fd22c0b45c9830cb2c to your computer and use it in GitHub Desktop.
How to create a local scoped npm module

How to create a local scoped npm module

  1. The main file of the module should be named index.js.
  2. Initialize the module by running npm init --scope=<your-scope>.
  3. Install local module with npm install --save <path-to-module>.

Example

Local module resides in lib/custom-module, the scope of the module should be marcuslilja.

  1. Run npm init --scope=marcuslilja in lib/custom-module.
  2. Run npm install --save lib/custom-module.
var customModule = require('@marcuslilja/custom-module');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment