npm2deb is an automatic tool which permits to fast deploy debian/* files starting from a module downloaded via npm.

sudo apt-get install npm2deb

If you want help in developing:

git clone

For usage information, please refer to npm2deb man page. There is a also a more detailed tutorial.

Workflow example 1

Step 1. Check dependencies

A simple workflow is check if a node_module has all dependencies already satisfied in Debian, you can use npm2deb depends to get this info.

In this example we will check jade module which at the moment is not packaged for Debian:

$ npm2deb depends -b -r jade
NPM                                               Debian
jade (1.3.1)                                      None
├─ monocle (1.1.51)                               None
│  └─ readdirp (~0.2.3)                           node-readdirp (0.2.4-2)
├─ transformers (2.1.0)                           None
│  ├─ uglify-js (~2.2.5)                          uglifyjs (1.3.5-1)
│  ├─ promise (~2.0)                              None
│  │  └─ asap (~1.0.0)                            None
│  └─ css (~1.0.8)                                None
│     ├─ css-stringify (1.4.1)                    None
│     │  └─ source-map (~0.1.31)                  None
│     │     └─ amdefine (>=0.0.4)                 None
│     └─ css-parse (1.7.0)                        None
├─ character-parser (1.2.0)                       None
├─ mkdirp (~0.3.5)                                node-mkdirp (0.3.5-1)
├─ commander (2.1.0)                              node-commander (2.0.0-1)
├─ constantinople (~2.0.0)                        None
│  └─ uglify-js (~2.4.0)                          uglifyjs (1.3.5-1)
└─ with (~3.0.0)                                  None
   └─ uglify-js (~2.4.12)                         uglifyjs (1.3.5-1)

As you can see, there are many modules not packaged for debian. npm2deb was written to reach this goal, have a tool to fast and easy package new nodejs module.

In this example we will take care about monocle module.

Step 2. Search for existing work

First of all, use npm2deb search to know if someone else has already started working on this module:

$ npm2deb search monocle
Looking for similiar package:
Looking for existing repositories:
Looking for wnpp bugs:

As you can see, there no info about monocle in Debian. So you can start to work on.

Step 3. Preview more information

Use npm2deb view command to get a preview information about module:

$ npm2deb view monocle
Name:                                   monocle
Version:                                1.1.51
Description:                            a tool for watching directories for file changes
License:                                BSD
Debian:                                 None

License is automatically recognize as BSD, if this does not happen, please pass --upstream-license option during creation to set a correct license.

Step 4. Create packaging files

Next step, make the debianization:

Following commands for lxc container creation:

# apt-get install lxc
# lxc-create -n deb-sid -t debian -- -r sid

See LXC for more.

Following commands for the docker container creation:

For Docker Installation in Debian/Ubuntu, Refer the following link :

#Install the docker service

 $apt-get install docker

#Create Debian Sid docker container 

 $docker run -it --name deb-sid debian:sid /bin/bash 

#Note: Give different name in --name option for creating new containers  

#Install the required packages in the container

 $apt-get install dh-make gem2deb npm2deb

#Press Ctl + p + q to exit from the container without stopping it.

# For accessing back the container 

 $ docker ps 

#Find the container ID and attach it to the current bash terminal using the following commands

 $docker attach <Container ID>  

$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
0cf9a333ad8b        debian:sid          "/bin/bash"         28 minutes ago      Up 2 minutes                            jolly

$docker attach 0cf9a333ad8b


$ npm2deb create monocle

This is not a crystal ball, so please take a look at auto-generated files.
You may want fix first these issues:
monocle/node-monocle/debian/control: FIX_ME long description

This command creates <module_name>/node-<module_name>/debian directory which contains the basic information about the module.

You have to fix every occurrence of FIX_ME in those files.

By default npm2deb set Vcs-* fields to git in pkg-javascript. For more information about git, please read GitPackaging.

Step 5. Create the package

Follow steps 3-7 from "Workflow example 2" below

For more information about Javascript Team Infrastracture please read the Javascript page.

Workflow example 2

Where uscan does not work because the upstream repo is missing tags. The node module we use is 'require-directory'. Follow these steps if you got this warning

*** Warning ***
Using fakeupstream to download npm dist tarballs, because upstream
git repo is missing tags. Its better to ask upstream to tag their releases
instead of using npm dist tarballs as dist tarballs may contain pre built files
and may not include tests.

Step 1. Create packaging files

Follow steps 1-4 from "Workflow example 1" above,

Step 2. Download source tarball

Usually this can be done by uscan --verbose --download-current-version but some projects does not create git tags for their releases so we have to visit their home page (given in 'debian/control') and find out the commit for the release (from their 'commits' page) or download the tarball from

Note: Current version of npm2deb already download orig tarballs from github if tag matching npm release is present or npm dist tarball if matching tag is missing in github. But if you need to include tests, you may follow Option 2 below to download github tarballs.

Option 1: Download via

This is the easier method but you may not get tests in these tarballs. Also if it includes pre-built files (output of uglifyjs, babel, browserify, webpack etc), you may want to follow Option 2 below.

$ cd require-directory
$ npm view require-directory dist.tarball
$ wget

Option 2: Download via commit snapshot

Note: You may also request the upstream to add the corresponding tag and wait a few days before choosing this option.

Commits page:

In this case 'bump to v2.1.1' commit is what we want Click on '<>' button on the right of this commit to browse repository on this commit.

'bump to v2.1.1 commit page:

Click on the 'Clone or download' button Right click on 'Download ZIP' and copy its url

ZIP download url:

Paste the link on the terminal and change .zip to .tar.gz and use wget command to download this file and give -O option to set a different name for the downloaded file

$ cd require-directory/
$ wget -O node-require-directory-2.1.1.tgz

Step 3. Create debian source package

Now combine the 'debian' directory we created earlier to the tar.gz file we downloaded

$ cd node-require-directory
$ uupdate -b ../node-require-directory-2.1.1.tgz

Note: If you already imported dsc file to git, you can use gbp import-orig --pristine-tar ../node-require-directory-2.1.1.tgz to import the tarball, after removing the upstream/2.1.1 tag (git tag -d upstream/2.1.1)

Switch to package directory and remove the extra line "* New upstream release" from debian/changelog

$ cd ../node-require-directory-2.1.1
$ dch -e
$ dpkg-source -b .

Step 4. Build the binary package

$ dpkg-buildpackage
$ lintian ../node-require-directory_2.1.1-1_amd64.changes

Import your package to git

You may import your dsc file to git at this point and commit your changes in git repo. See the commands given below.

$ cd ..
$ rm -rf node-require-directory
$ gbp import-dsc --pristine-tar node-require-directory_2.1.1-1.dsc
$ cd node-require-directory
$ git tag -d debian/2.1.1-1

It would be a good idea to add --pristine-tar option to gbp command as default in ~/.gbp.conf

pristine-tar = True

Make your package lintian clean

Make sure you fix all the errors and warnings shown by lintian. Every time you make a change to any file inside debian directory. Run dpkg-buildpackage and lintian commands to make sure the warning/error is actually fixed.

$ licensecheck --deb-machine -r -l0 *

Update debian/copyright with any missing information.

You can also use libconfig-model-dpkg-perl (# apt-get install libconfig-model-dpkg-perl) to update debian/copyright.

$ cme update dpkg-copyright

Run tests if available

Use this example commit as reference.

  1. You can find the test command from package.json under scripts section.

  2. You need to add the test command under override_dh_auto_test.

  3. You need to add the test framework (mocha, node-tape etc) as a build dependency.
  4. You need to add a Test-Command section to debian/tests/control.

ITP (Intend to Package bug)

Clean build with sbuild

$ sudo apt-get install sbuild
$ sudo sbuild-adduser $LOGNAME
     ... *logout* and *re-login* or use `newgrp sbuild` in your current shell
$ sudo sbuild-createchroot --include=eatmydata,ccache,gnupg unstable /srv/chroot/unstable-amd64-sbuild
$ sudo sbuild -A -d unstable ../node-require-directory_2.1.1-1.dsc

See sbuild for more options.

# apt-get install autopkgtest
# dpkg -i ../node-require-directory_2.1.1-1_all.deb
$ adt-run ./ --- null

Step 5. Request sponsorship

Step 6. Push your repo to alioth

Once you are added to pkg-javascript team on alioth, you can push your changes directly to alioth.

$ mkdir node-require-directory
$ cd node-require-directory
$ gbp create-remote-repo --remote-url-pattern='git+ssh://'

Or create it manually

$ ssh
$ cd /git/pkg-javascript
$ ./setup-repository node-require-directory 'Packaging for node-require-directory'

$ git remote add origin git+ssh://
$ git push --all && git push --tags
$ git branch upstream --track origin/upstream
$ git branch pristine-tar --track origin/pristine-tar

RFS Checklist

Please make sure you have taken care of these common issues before sending an RFS mail.

  1. You MUST check if the module is already packaged. Run npm2deb search before you file an ITP. Check carefully for existing package, previous work or warnings.

  2. Description should be good for debian standards, both in ITP and debian/control. Mention it is a dependency of ava or browserify as the case may be. Description line should be split less than 80 characters but not too small like 30 or 40. Please manually verify no FIX_ME is remaining in control, copyright or changelog.
  3. Make sure --pristine-tar option is given when gbp import-dsc is run
  4. You MUST delete the debian tag
  5. You MUST push all branches (master, upstream and pristine-tar)
  6. You MUST make your package lintian clean every time you make changes to your package
  7. You MUST make it build in a clean chroot using tools like sbuild every time you make a change
  8. If tests are present and test framework is packaged, tests should be enabled in rules and tests/control. Check package,json for how to run the tests.
  9. You should check email for the comments you receive for ITP or RFS or ftp master rejection and fix them.
  10. If you don't get a reply to your RFS, please wait for at least a week before sending a reminder. If you have to send a reminder please reply to the previous RFS mail instead of writing a new mail.
  11. You should cc/copy your ITP when you send RFS
  12. You MUST import your package to alioth if you are a member of pkg-javascript team.

Updating a package to new upstream release

  1. Clone the current repo gbp clone --pristine-tar gbp clone --pristine-tar  git+ssh://

  2. Download new upstream release tarball using uscan --verbose or use "Step 2, Option 2" above to manually download the new upstream release tarball.

  3. Import the orig.tar.gz using gbp import-orig --pristine-tar --uscan or gbp import-orig --pristine-tar ../<upstream-version.tar.gz>.

  4. Add a new section to changelog by running dch -i or dch --team

  5. Build the package using dpkg-buildpackage

  6. Make it lintian clean
  7. Build in clean chroot (using tools like sbuild)