bier hier
bier hier

Reputation: 22550

How to define dependency in package.json for gitrepository?

In my reactjs project I have a dependency on a module that is in another gitrepo(stash) so I created this in my package.json as a property of dependencies :

"somemodule":{
  "name": "somemodule",
  "dependencies": {
    "private-repo": "https://link_to_the_other_repo"
  }
}

This repo contains a minified version and non minified version of the same file. When I run npm install the module does not get installed, there is no error message either. How can I create this dependency? I have managed to get the dist/minified version of the file from the other repo. How can I refer to this in my package.json?

Upvotes: 1

Views: 437

Answers (1)

Niraj Chauhan
Niraj Chauhan

Reputation: 7880

To add a private git module:

If you have RSA key added to your machine(secure & recommended):

"dependencies": {
    "package-name": "git+ssh://[email protected]/project/repo.git"
}

If you want https:

"dependencies": {
        "package-name": "git+https://username:[email protected]/project/repo.git"
}

Its not recommended to store username, password in your package.json file, so better add ssh keygen to your machine and use the first one.

Upvotes: 1

Related Questions