user8398743
user8398743

Reputation:

Install module without the original npm installation

There is a module that I want to try and make some changes to, for a test.

The code is here:

https://github.com/BTMorton/angular2-grid

Right now to install this in my project I just need to type: npm install angular2-grid from my terminal.

My question is:

If I downloaded the code from github and made some changes to it,

How do I install it in my product and test it if my test changes are not on npm repo?

Upvotes: 0

Views: 27

Answers (2)

Md. Abu Taher
Md. Abu Taher

Reputation: 18836

Way 1: Relative Path

  1. clone repo and edit the code, then build it.
  2. Use it with relative path.

Done!

import { NgGridModule } from './angular2-grid';

Way 2: npm link

cd ~/projects/angular2-grid # go into the package directory (and edit and build)
npm link                    # creates global link
cd ~/projects/myProject     # go into some other package directory.
npm link angular2-grid      # link-install the package

Way 3: npm install <git repo>

Fork and push changes to your repo and

npm install --save <your repo address>

example,

npm install --save https://github.com/YOURUSERNAME/angular2-grid

There are probably lot of other ways to deal with it. But these above will be enough for you.

Upvotes: 1

Matt Fletcher
Matt Fletcher

Reputation: 9240

You can install npm modules locally.

Just use npm install file:/path/to/your/repo

Alternately, you could fork the repo and then use a github link:

npm install github:yourname/angular2-grid.git

Upvotes: 0

Related Questions