Creating npm package from scratch

The Node Package Manager seems to do wonderful job, it is simple to understand and has really well built up. I have created one simple IMDB scraper, which I want to add into repository so I’ll share my tips step by step.

1. I have already created directory imdb-rscraper, put all the package files in the folder, if you have many files create separate folder lib.

2. Create new file called package.json(touch package.json),this is the file where all the metadata is listed. You could basicaly use this template.

    "name": "imdb-rscraper",
    "author": "No Public Name here",
    "homepage": "",
    "version": "0.0.1",
    "description": "Scraping the data from IMDB with JQuery selectors",
    "main": "imdb-rscraper.js",
    "keywords": [
    "dependencies" : {
        "jsdom": ">= 0.2.12"
    "repository" : {
        "type" : "git",
        "url" : ""

3. Now make symlink the package folder run npm link. Creates link /usr/local/lib/node_modules/imdb-rscraper -> /home/risto/node/imdb-rscraper

4. Create the README file for better understanding even for yourself, give brief overview how to use your library, tool.

5. Before publishing you have to create user in repository npm adduser fill the user fields and the publish npm publish. After the last step you should see something like this. Give feedback if I missed something.

npm http PUT
npm http 201
npm http GET
npm http 200
npm http PUT
npm http 201
npm http GET
npm http 200
npm http PUT
npm http 201
+ imdb-rscraper@0.0.1

6. Visit and search for your package with the declared information for each version.



2 thoughts on “Creating npm package from scratch

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s