How to install a private NPM module without my own registry?
up vote
279
down vote
favorite
I've taken some shared code and put it in an NPM module, one I don't want to upload to the central registry. The question is, how do I install it from other projects?
The obvious way is probably to set up my own NPM registry, but according to the documentation, that involves a lot of hassle.
Can I just install an NPM module that sits on the local filesystem, or perhaps even from git?
npm install --from-git git@server:project
node.js npm package npm-private-modules
add a comment |
up vote
279
down vote
favorite
I've taken some shared code and put it in an NPM module, one I don't want to upload to the central registry. The question is, how do I install it from other projects?
The obvious way is probably to set up my own NPM registry, but according to the documentation, that involves a lot of hassle.
Can I just install an NPM module that sits on the local filesystem, or perhaps even from git?
npm install --from-git git@server:project
node.js npm package npm-private-modules
add a comment |
up vote
279
down vote
favorite
up vote
279
down vote
favorite
I've taken some shared code and put it in an NPM module, one I don't want to upload to the central registry. The question is, how do I install it from other projects?
The obvious way is probably to set up my own NPM registry, but according to the documentation, that involves a lot of hassle.
Can I just install an NPM module that sits on the local filesystem, or perhaps even from git?
npm install --from-git git@server:project
node.js npm package npm-private-modules
I've taken some shared code and put it in an NPM module, one I don't want to upload to the central registry. The question is, how do I install it from other projects?
The obvious way is probably to set up my own NPM registry, but according to the documentation, that involves a lot of hassle.
Can I just install an NPM module that sits on the local filesystem, or perhaps even from git?
npm install --from-git git@server:project
node.js npm package npm-private-modules
node.js npm package npm-private-modules
edited Aug 4 '16 at 10:27
Yves M.
18k116897
18k116897
asked Apr 30 '12 at 15:33
futlib
3,41583350
3,41583350
add a comment |
add a comment |
13 Answers
13
active
oldest
votes
up vote
228
down vote
accepted
cd somedir
npm install .
or
npm install path/to/somedir
somedir
must contain the package.json
inside it.
It knows about git too:
npm install git://github.com/visionmedia/express.git
3
The path/to/somedir solution kind of works, but then it's kind of awful because all of the require statements then have to include that relative or absolute path. Please correct me if I'm doing something wrong...
– Luke Bayes
Oct 25 '12 at 3:40
3
@Luke yes, you're wrong. Afternpm install
all the files are copied to your project directory. So the paths in therequire
statements will be relative only to your project directory.
– mihai
Oct 25 '12 at 7:52
3
I'm confused by the top part and the only reason I haven't tested this myself is that I'm still learning and don't have a private module to work on. Anyway, by changing your directory to where the module is and then callinginstall
wouldn't that just install there and not for the project you want to use it for?
– Adam Beck
Jan 28 '13 at 4:48
8
Side note: (a) when using git repos, you can specify a branch/commit/tag by adding a#<ref>
to the end of the git url, eggit://github.com/visionmedia/express.git#v0.0.1
; (b) To be safe add"private": true
to the package.json of your private repos. This will make sure npm will never let you accidentally publish your secret sauce to the official npm registry. (according to debuggable.com/posts/…)
– Rafael Xavier
Mar 26 '13 at 19:32
8
FYI if you are serving your git up via http you'll need tonpm i git+http://all/the/things.git
even thoughgit clone http://all/the/things.git
works just fine
– slf
May 30 '13 at 19:09
|
show 5 more comments
up vote
475
down vote
In your private npm modules add
"private": true
to your package.json
Then to reference the private module in another module, use this in your package.json
{
"name": "myapp",
"dependencies": {
"private-repo": "git+ssh://git@github.com:myaccount/myprivate.git#v1.0.0",
}
}
47
This is the real correct answer if you want your package.json to maintain the private repo dependency list, which is a Good Thing(tm) that you should be doing.
– David Ellis
Apr 24 '13 at 22:44
Thanks - this is perfect. One problem - it works if I don't include the # version at the end, but if I do, I get an error like this: "Error: Command failed: fatal: ambiguous argument 'v0.0.1': unknown revision or path not in the working tree." I can't find a solution to this. Do you know what's going on?
– Jake
Aug 14 '13 at 17:48
5
In the example it's referencing a specific tag, but if you don't have one then it'll default to master. (see git-scm.com/book/en/Git-Basics-Tagging)
– 250R
Aug 15 '13 at 0:17
3
I don't understand how this command line can download code from a private github repo if I am not supllying my credentials! So how can I pass my github credentials?
– Renato Gama
Dec 9 '13 at 19:57
20
Note that the"private": true
part isn't necessary, but it will help prevent your private repo from accidentally being published to the public npm registry.
– evanrmurphy
Sep 10 '14 at 18:14
|
show 8 more comments
up vote
57
down vote
Can I just install an NPM package that sits on the local filesystem, or perhaps even from git?
Yes you can! From the docs https://docs.npmjs.com/cli/install
A package is:
- a) a folder containing a program described by a package.json file
- b) a gzipped tarball containing (a)
- c) a url that resolves to (b)
- d) a
<name>@<version>
that is published on the registry with (c)
- e) a
<name>@<tag>
that points to (d)
- f) a
<name>
that has a "latest" tag satisfying (e)
- g) a
<git remote url>
that resolves to (b)
Isn't npm brilliant?
Note that if you go for option b), it actually has to be a gzipped tarball, a mere zip archive won't do it. I.e. if you create your package withtar -czf my-package.tar.gz dist
(assuming yourdist
folder also has a properpackage.json
file in it), then you cannpm install ../my-lib/my-package.tar.gz
from your other project.
– Dániel Kis-Nagy
Sep 17 at 11:56
add a comment |
up vote
38
down vote
Update January 2016
In addition to other answers, there is sometimes the scenario where you wish to have private modules available in a team context.
Both Github and Bitbucket support the concept of generating a team API Key. This API key can be used as the password to perform API requests as this team.
In your private npm modules add
"private": true
to your package.json
Then to reference the private module in another module, use this in your package.json
{
"name": "myapp",
"dependencies": {
"private-repo":
"git+https://myteamname:aQqtcplwFzlumj0mIDdRGCbsAq5d6Xg4@bitbucket.org/myprivate.git",
}
}
where team name = myteamname, and API Key = aQqtcplwFzlumj0mIDdRGCbsAq5d6Xg4
Here I reference a bitbucket repo, but it is almost identical using github too.
Finally, as an alternative, if you really don't mind paying $7 per month (as of writing) then you can now have private NPM modules out of the box.
Can you use this if you want to have a global module?
– PI.
Jan 13 '16 at 10:31
This does not work for me I am afraid. Both the remote and the repository are not found. Any ideas?
– Thomas Bormans
Feb 3 '16 at 15:50
@ThomasBormans - still having trouble? Please paste (scramble your teamname / api key) what you have as your line in dependencies section of your package.json - as per above instructions. I have found this works well for both github and bitbucket private repos. Which are you using?
– arcseldon
Feb 3 '16 at 17:50
@arcseldon "name": "git+key:x-oauth-basic@bitbucket.org/user/repo.git" returns EISDIR: illegal operation on a directory, read. And "name": "git+user:key@bitbucket.org/repo.git" returns several errors including these words remote: Not Found, fatal: repository, Command failed: git clone. Any ideas?
– Thomas Bormans
Feb 3 '16 at 17:59
Try to follow the "exact" format I have given in answer: "git+https://<myteamname>:<my_key>@bitbucket.org/<my_repo_name>.git How did you generate the API key? Have you double checked it is correct in your bitbucket settings... sorry to ask the obvious, but i have near 100% confidence this should work.
– arcseldon
Feb 3 '16 at 18:09
|
show 7 more comments
up vote
24
down vote
FWIW: I had problems with all of these answers when dealing with a private organization repository.
The following worked for me:
npm install -S "git+https://username@github.com/orgname/repositoryname.git"
For example:
npm install -S "git+https://blesh@github.com/netflix/private-repository.git"
I'm not entirely sure why the other answers didn't work for me in this one case, because they're what I tried first before I hit Google and found this answer. And the other answers are what I've done in the past.
Hopefully this helps someone else.
2
Can you use a subfolder of the git repo?
– Chris
Oct 10 '14 at 18:28
Not sure, I haven't tried that.
– Ben Lesh
Oct 10 '14 at 20:46
add a comment |
up vote
7
down vote
I had this same problem, and after some searching around, I found Reggie (https://github.com/mbrevoort/node-reggie). It looks pretty solid. It allows for lightweight publishing of NPM modules to private servers. Not perfect (no authentication upon installation), and it's still really young, but I tested it locally, and it seems to do what it says it should do.
That is... (and this just from their docs)
npm install -g reggie
reggie-server -d ~/.reggie
then cd into your module directory and...
reggie -u http://<host:port> publish
reggie -u http://127.0.0.1:8080 publish
finally, you can install packages from reggie just by using that url either in a direct npm install command, or from within a package.json... like so
npm install http://<host:port>/package/<name>/<version>
npm install http://<host:port>/package/foo/1.0.0
or..
dependencies: {
"foo": "http://<host:port>/package/foo/1.0.0"
}
add a comment |
up vote
6
down vote
Structure your code in an accessible fashion like below. If this is possible for you.
NodeProjsAppsMainApppackage.json
NodeProjsModulesDataModulepackage.json
Within MainApp @ NodProjsAppsMainApp
npm install --S ../../Modules/DataModule
You may need to update package.json as:
"dependencies": {
"datamodule": "../../Modules/DataModule"
}
This worked for my situation.
add a comment |
up vote
3
down vote
Starting with arcseldon's answer, I found that the team name was needed in the URL like so:
npm install --save "git+https://myteamname@aQqtcplwFzlumj0mIDdRGCbsAq5d6Xg4@bitbucket.org/myteamname/myprivate.git"
And note that the API key is only available for the team, not individual users.
add a comment |
up vote
2
down vote
Npm now provides unlimited private hosted modules for $7/user/month used like so
cd private-project
npm login
in your package json set "name": " @username/private-project"
npm publish
then to require your project:
cd ../new-project
npm install --save @username/private-project
Does this require a client-side login step?
– Aidan Hoolachan
Dec 16 '17 at 2:22
What's an alternative to this? For example, if you want to host your "package" on S3 and pull from there.
– Con Antonakos
Nov 27 at 22:19
add a comment |
up vote
1
down vote
Config to install from public Github repository, even if machine is under firewall:
dependencies: {
"foo": "https://github.com/package/foo/tarball/master"
}
add a comment |
up vote
1
down vote
I use the following with a private github repository:
npm install github:mygithubuser/myproject
add a comment |
up vote
0
down vote
Very simple -
npm config set registry https://path-to-your-registry/
It actually sets registry = "https://path-to-your-registry"
this line to /Users/<ur-machine-user-name>/.npmrc
All the value you have set explicitly or have been set by default can be seen by - npm config list
add a comment |
up vote
0
down vote
This was what I was looking for:
# Get the latest from GitHub, public repo:
$ npm install username/my-new-project --save-dev
# Bitbucket, private repo:
$ npm install git+https://token:x-oauth-basic@github.com/username/my-new-project.git#master
$ npm install git+ssh://git@github.com/username/my-new-project.git#master
# … or from Bitbucket, public repo:
$ npm install git+ssh://git@bitbucket.org/username/my-new-project.git#master --save-dev
# Bitbucket, private repo:
$ npm install git+https://username:password@bitbucket.org/username/my-new-project.git#master
$ npm install git+ssh://git@bitbucket.org/username/my-new-project.git#master
# Or, if you published as npm package:
$ npm install my-new-project --save-dev
add a comment |
13 Answers
13
active
oldest
votes
13 Answers
13
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
228
down vote
accepted
cd somedir
npm install .
or
npm install path/to/somedir
somedir
must contain the package.json
inside it.
It knows about git too:
npm install git://github.com/visionmedia/express.git
3
The path/to/somedir solution kind of works, but then it's kind of awful because all of the require statements then have to include that relative or absolute path. Please correct me if I'm doing something wrong...
– Luke Bayes
Oct 25 '12 at 3:40
3
@Luke yes, you're wrong. Afternpm install
all the files are copied to your project directory. So the paths in therequire
statements will be relative only to your project directory.
– mihai
Oct 25 '12 at 7:52
3
I'm confused by the top part and the only reason I haven't tested this myself is that I'm still learning and don't have a private module to work on. Anyway, by changing your directory to where the module is and then callinginstall
wouldn't that just install there and not for the project you want to use it for?
– Adam Beck
Jan 28 '13 at 4:48
8
Side note: (a) when using git repos, you can specify a branch/commit/tag by adding a#<ref>
to the end of the git url, eggit://github.com/visionmedia/express.git#v0.0.1
; (b) To be safe add"private": true
to the package.json of your private repos. This will make sure npm will never let you accidentally publish your secret sauce to the official npm registry. (according to debuggable.com/posts/…)
– Rafael Xavier
Mar 26 '13 at 19:32
8
FYI if you are serving your git up via http you'll need tonpm i git+http://all/the/things.git
even thoughgit clone http://all/the/things.git
works just fine
– slf
May 30 '13 at 19:09
|
show 5 more comments
up vote
228
down vote
accepted
cd somedir
npm install .
or
npm install path/to/somedir
somedir
must contain the package.json
inside it.
It knows about git too:
npm install git://github.com/visionmedia/express.git
3
The path/to/somedir solution kind of works, but then it's kind of awful because all of the require statements then have to include that relative or absolute path. Please correct me if I'm doing something wrong...
– Luke Bayes
Oct 25 '12 at 3:40
3
@Luke yes, you're wrong. Afternpm install
all the files are copied to your project directory. So the paths in therequire
statements will be relative only to your project directory.
– mihai
Oct 25 '12 at 7:52
3
I'm confused by the top part and the only reason I haven't tested this myself is that I'm still learning and don't have a private module to work on. Anyway, by changing your directory to where the module is and then callinginstall
wouldn't that just install there and not for the project you want to use it for?
– Adam Beck
Jan 28 '13 at 4:48
8
Side note: (a) when using git repos, you can specify a branch/commit/tag by adding a#<ref>
to the end of the git url, eggit://github.com/visionmedia/express.git#v0.0.1
; (b) To be safe add"private": true
to the package.json of your private repos. This will make sure npm will never let you accidentally publish your secret sauce to the official npm registry. (according to debuggable.com/posts/…)
– Rafael Xavier
Mar 26 '13 at 19:32
8
FYI if you are serving your git up via http you'll need tonpm i git+http://all/the/things.git
even thoughgit clone http://all/the/things.git
works just fine
– slf
May 30 '13 at 19:09
|
show 5 more comments
up vote
228
down vote
accepted
up vote
228
down vote
accepted
cd somedir
npm install .
or
npm install path/to/somedir
somedir
must contain the package.json
inside it.
It knows about git too:
npm install git://github.com/visionmedia/express.git
cd somedir
npm install .
or
npm install path/to/somedir
somedir
must contain the package.json
inside it.
It knows about git too:
npm install git://github.com/visionmedia/express.git
edited Apr 30 '12 at 21:47
answered Apr 30 '12 at 18:44
mihai
23.1k73968
23.1k73968
3
The path/to/somedir solution kind of works, but then it's kind of awful because all of the require statements then have to include that relative or absolute path. Please correct me if I'm doing something wrong...
– Luke Bayes
Oct 25 '12 at 3:40
3
@Luke yes, you're wrong. Afternpm install
all the files are copied to your project directory. So the paths in therequire
statements will be relative only to your project directory.
– mihai
Oct 25 '12 at 7:52
3
I'm confused by the top part and the only reason I haven't tested this myself is that I'm still learning and don't have a private module to work on. Anyway, by changing your directory to where the module is and then callinginstall
wouldn't that just install there and not for the project you want to use it for?
– Adam Beck
Jan 28 '13 at 4:48
8
Side note: (a) when using git repos, you can specify a branch/commit/tag by adding a#<ref>
to the end of the git url, eggit://github.com/visionmedia/express.git#v0.0.1
; (b) To be safe add"private": true
to the package.json of your private repos. This will make sure npm will never let you accidentally publish your secret sauce to the official npm registry. (according to debuggable.com/posts/…)
– Rafael Xavier
Mar 26 '13 at 19:32
8
FYI if you are serving your git up via http you'll need tonpm i git+http://all/the/things.git
even thoughgit clone http://all/the/things.git
works just fine
– slf
May 30 '13 at 19:09
|
show 5 more comments
3
The path/to/somedir solution kind of works, but then it's kind of awful because all of the require statements then have to include that relative or absolute path. Please correct me if I'm doing something wrong...
– Luke Bayes
Oct 25 '12 at 3:40
3
@Luke yes, you're wrong. Afternpm install
all the files are copied to your project directory. So the paths in therequire
statements will be relative only to your project directory.
– mihai
Oct 25 '12 at 7:52
3
I'm confused by the top part and the only reason I haven't tested this myself is that I'm still learning and don't have a private module to work on. Anyway, by changing your directory to where the module is and then callinginstall
wouldn't that just install there and not for the project you want to use it for?
– Adam Beck
Jan 28 '13 at 4:48
8
Side note: (a) when using git repos, you can specify a branch/commit/tag by adding a#<ref>
to the end of the git url, eggit://github.com/visionmedia/express.git#v0.0.1
; (b) To be safe add"private": true
to the package.json of your private repos. This will make sure npm will never let you accidentally publish your secret sauce to the official npm registry. (according to debuggable.com/posts/…)
– Rafael Xavier
Mar 26 '13 at 19:32
8
FYI if you are serving your git up via http you'll need tonpm i git+http://all/the/things.git
even thoughgit clone http://all/the/things.git
works just fine
– slf
May 30 '13 at 19:09
3
3
The path/to/somedir solution kind of works, but then it's kind of awful because all of the require statements then have to include that relative or absolute path. Please correct me if I'm doing something wrong...
– Luke Bayes
Oct 25 '12 at 3:40
The path/to/somedir solution kind of works, but then it's kind of awful because all of the require statements then have to include that relative or absolute path. Please correct me if I'm doing something wrong...
– Luke Bayes
Oct 25 '12 at 3:40
3
3
@Luke yes, you're wrong. After
npm install
all the files are copied to your project directory. So the paths in the require
statements will be relative only to your project directory.– mihai
Oct 25 '12 at 7:52
@Luke yes, you're wrong. After
npm install
all the files are copied to your project directory. So the paths in the require
statements will be relative only to your project directory.– mihai
Oct 25 '12 at 7:52
3
3
I'm confused by the top part and the only reason I haven't tested this myself is that I'm still learning and don't have a private module to work on. Anyway, by changing your directory to where the module is and then calling
install
wouldn't that just install there and not for the project you want to use it for?– Adam Beck
Jan 28 '13 at 4:48
I'm confused by the top part and the only reason I haven't tested this myself is that I'm still learning and don't have a private module to work on. Anyway, by changing your directory to where the module is and then calling
install
wouldn't that just install there and not for the project you want to use it for?– Adam Beck
Jan 28 '13 at 4:48
8
8
Side note: (a) when using git repos, you can specify a branch/commit/tag by adding a
#<ref>
to the end of the git url, eg git://github.com/visionmedia/express.git#v0.0.1
; (b) To be safe add "private": true
to the package.json of your private repos. This will make sure npm will never let you accidentally publish your secret sauce to the official npm registry. (according to debuggable.com/posts/…)– Rafael Xavier
Mar 26 '13 at 19:32
Side note: (a) when using git repos, you can specify a branch/commit/tag by adding a
#<ref>
to the end of the git url, eg git://github.com/visionmedia/express.git#v0.0.1
; (b) To be safe add "private": true
to the package.json of your private repos. This will make sure npm will never let you accidentally publish your secret sauce to the official npm registry. (according to debuggable.com/posts/…)– Rafael Xavier
Mar 26 '13 at 19:32
8
8
FYI if you are serving your git up via http you'll need to
npm i git+http://all/the/things.git
even though git clone http://all/the/things.git
works just fine– slf
May 30 '13 at 19:09
FYI if you are serving your git up via http you'll need to
npm i git+http://all/the/things.git
even though git clone http://all/the/things.git
works just fine– slf
May 30 '13 at 19:09
|
show 5 more comments
up vote
475
down vote
In your private npm modules add
"private": true
to your package.json
Then to reference the private module in another module, use this in your package.json
{
"name": "myapp",
"dependencies": {
"private-repo": "git+ssh://git@github.com:myaccount/myprivate.git#v1.0.0",
}
}
47
This is the real correct answer if you want your package.json to maintain the private repo dependency list, which is a Good Thing(tm) that you should be doing.
– David Ellis
Apr 24 '13 at 22:44
Thanks - this is perfect. One problem - it works if I don't include the # version at the end, but if I do, I get an error like this: "Error: Command failed: fatal: ambiguous argument 'v0.0.1': unknown revision or path not in the working tree." I can't find a solution to this. Do you know what's going on?
– Jake
Aug 14 '13 at 17:48
5
In the example it's referencing a specific tag, but if you don't have one then it'll default to master. (see git-scm.com/book/en/Git-Basics-Tagging)
– 250R
Aug 15 '13 at 0:17
3
I don't understand how this command line can download code from a private github repo if I am not supllying my credentials! So how can I pass my github credentials?
– Renato Gama
Dec 9 '13 at 19:57
20
Note that the"private": true
part isn't necessary, but it will help prevent your private repo from accidentally being published to the public npm registry.
– evanrmurphy
Sep 10 '14 at 18:14
|
show 8 more comments
up vote
475
down vote
In your private npm modules add
"private": true
to your package.json
Then to reference the private module in another module, use this in your package.json
{
"name": "myapp",
"dependencies": {
"private-repo": "git+ssh://git@github.com:myaccount/myprivate.git#v1.0.0",
}
}
47
This is the real correct answer if you want your package.json to maintain the private repo dependency list, which is a Good Thing(tm) that you should be doing.
– David Ellis
Apr 24 '13 at 22:44
Thanks - this is perfect. One problem - it works if I don't include the # version at the end, but if I do, I get an error like this: "Error: Command failed: fatal: ambiguous argument 'v0.0.1': unknown revision or path not in the working tree." I can't find a solution to this. Do you know what's going on?
– Jake
Aug 14 '13 at 17:48
5
In the example it's referencing a specific tag, but if you don't have one then it'll default to master. (see git-scm.com/book/en/Git-Basics-Tagging)
– 250R
Aug 15 '13 at 0:17
3
I don't understand how this command line can download code from a private github repo if I am not supllying my credentials! So how can I pass my github credentials?
– Renato Gama
Dec 9 '13 at 19:57
20
Note that the"private": true
part isn't necessary, but it will help prevent your private repo from accidentally being published to the public npm registry.
– evanrmurphy
Sep 10 '14 at 18:14
|
show 8 more comments
up vote
475
down vote
up vote
475
down vote
In your private npm modules add
"private": true
to your package.json
Then to reference the private module in another module, use this in your package.json
{
"name": "myapp",
"dependencies": {
"private-repo": "git+ssh://git@github.com:myaccount/myprivate.git#v1.0.0",
}
}
In your private npm modules add
"private": true
to your package.json
Then to reference the private module in another module, use this in your package.json
{
"name": "myapp",
"dependencies": {
"private-repo": "git+ssh://git@github.com:myaccount/myprivate.git#v1.0.0",
}
}
edited May 21 '14 at 16:27
heckj
4,57422635
4,57422635
answered Apr 30 '12 at 23:09
250R
22.2k62724
22.2k62724
47
This is the real correct answer if you want your package.json to maintain the private repo dependency list, which is a Good Thing(tm) that you should be doing.
– David Ellis
Apr 24 '13 at 22:44
Thanks - this is perfect. One problem - it works if I don't include the # version at the end, but if I do, I get an error like this: "Error: Command failed: fatal: ambiguous argument 'v0.0.1': unknown revision or path not in the working tree." I can't find a solution to this. Do you know what's going on?
– Jake
Aug 14 '13 at 17:48
5
In the example it's referencing a specific tag, but if you don't have one then it'll default to master. (see git-scm.com/book/en/Git-Basics-Tagging)
– 250R
Aug 15 '13 at 0:17
3
I don't understand how this command line can download code from a private github repo if I am not supllying my credentials! So how can I pass my github credentials?
– Renato Gama
Dec 9 '13 at 19:57
20
Note that the"private": true
part isn't necessary, but it will help prevent your private repo from accidentally being published to the public npm registry.
– evanrmurphy
Sep 10 '14 at 18:14
|
show 8 more comments
47
This is the real correct answer if you want your package.json to maintain the private repo dependency list, which is a Good Thing(tm) that you should be doing.
– David Ellis
Apr 24 '13 at 22:44
Thanks - this is perfect. One problem - it works if I don't include the # version at the end, but if I do, I get an error like this: "Error: Command failed: fatal: ambiguous argument 'v0.0.1': unknown revision or path not in the working tree." I can't find a solution to this. Do you know what's going on?
– Jake
Aug 14 '13 at 17:48
5
In the example it's referencing a specific tag, but if you don't have one then it'll default to master. (see git-scm.com/book/en/Git-Basics-Tagging)
– 250R
Aug 15 '13 at 0:17
3
I don't understand how this command line can download code from a private github repo if I am not supllying my credentials! So how can I pass my github credentials?
– Renato Gama
Dec 9 '13 at 19:57
20
Note that the"private": true
part isn't necessary, but it will help prevent your private repo from accidentally being published to the public npm registry.
– evanrmurphy
Sep 10 '14 at 18:14
47
47
This is the real correct answer if you want your package.json to maintain the private repo dependency list, which is a Good Thing(tm) that you should be doing.
– David Ellis
Apr 24 '13 at 22:44
This is the real correct answer if you want your package.json to maintain the private repo dependency list, which is a Good Thing(tm) that you should be doing.
– David Ellis
Apr 24 '13 at 22:44
Thanks - this is perfect. One problem - it works if I don't include the # version at the end, but if I do, I get an error like this: "Error: Command failed: fatal: ambiguous argument 'v0.0.1': unknown revision or path not in the working tree." I can't find a solution to this. Do you know what's going on?
– Jake
Aug 14 '13 at 17:48
Thanks - this is perfect. One problem - it works if I don't include the # version at the end, but if I do, I get an error like this: "Error: Command failed: fatal: ambiguous argument 'v0.0.1': unknown revision or path not in the working tree." I can't find a solution to this. Do you know what's going on?
– Jake
Aug 14 '13 at 17:48
5
5
In the example it's referencing a specific tag, but if you don't have one then it'll default to master. (see git-scm.com/book/en/Git-Basics-Tagging)
– 250R
Aug 15 '13 at 0:17
In the example it's referencing a specific tag, but if you don't have one then it'll default to master. (see git-scm.com/book/en/Git-Basics-Tagging)
– 250R
Aug 15 '13 at 0:17
3
3
I don't understand how this command line can download code from a private github repo if I am not supllying my credentials! So how can I pass my github credentials?
– Renato Gama
Dec 9 '13 at 19:57
I don't understand how this command line can download code from a private github repo if I am not supllying my credentials! So how can I pass my github credentials?
– Renato Gama
Dec 9 '13 at 19:57
20
20
Note that the
"private": true
part isn't necessary, but it will help prevent your private repo from accidentally being published to the public npm registry.– evanrmurphy
Sep 10 '14 at 18:14
Note that the
"private": true
part isn't necessary, but it will help prevent your private repo from accidentally being published to the public npm registry.– evanrmurphy
Sep 10 '14 at 18:14
|
show 8 more comments
up vote
57
down vote
Can I just install an NPM package that sits on the local filesystem, or perhaps even from git?
Yes you can! From the docs https://docs.npmjs.com/cli/install
A package is:
- a) a folder containing a program described by a package.json file
- b) a gzipped tarball containing (a)
- c) a url that resolves to (b)
- d) a
<name>@<version>
that is published on the registry with (c)
- e) a
<name>@<tag>
that points to (d)
- f) a
<name>
that has a "latest" tag satisfying (e)
- g) a
<git remote url>
that resolves to (b)
Isn't npm brilliant?
Note that if you go for option b), it actually has to be a gzipped tarball, a mere zip archive won't do it. I.e. if you create your package withtar -czf my-package.tar.gz dist
(assuming yourdist
folder also has a properpackage.json
file in it), then you cannpm install ../my-lib/my-package.tar.gz
from your other project.
– Dániel Kis-Nagy
Sep 17 at 11:56
add a comment |
up vote
57
down vote
Can I just install an NPM package that sits on the local filesystem, or perhaps even from git?
Yes you can! From the docs https://docs.npmjs.com/cli/install
A package is:
- a) a folder containing a program described by a package.json file
- b) a gzipped tarball containing (a)
- c) a url that resolves to (b)
- d) a
<name>@<version>
that is published on the registry with (c)
- e) a
<name>@<tag>
that points to (d)
- f) a
<name>
that has a "latest" tag satisfying (e)
- g) a
<git remote url>
that resolves to (b)
Isn't npm brilliant?
Note that if you go for option b), it actually has to be a gzipped tarball, a mere zip archive won't do it. I.e. if you create your package withtar -czf my-package.tar.gz dist
(assuming yourdist
folder also has a properpackage.json
file in it), then you cannpm install ../my-lib/my-package.tar.gz
from your other project.
– Dániel Kis-Nagy
Sep 17 at 11:56
add a comment |
up vote
57
down vote
up vote
57
down vote
Can I just install an NPM package that sits on the local filesystem, or perhaps even from git?
Yes you can! From the docs https://docs.npmjs.com/cli/install
A package is:
- a) a folder containing a program described by a package.json file
- b) a gzipped tarball containing (a)
- c) a url that resolves to (b)
- d) a
<name>@<version>
that is published on the registry with (c)
- e) a
<name>@<tag>
that points to (d)
- f) a
<name>
that has a "latest" tag satisfying (e)
- g) a
<git remote url>
that resolves to (b)
Isn't npm brilliant?
Can I just install an NPM package that sits on the local filesystem, or perhaps even from git?
Yes you can! From the docs https://docs.npmjs.com/cli/install
A package is:
- a) a folder containing a program described by a package.json file
- b) a gzipped tarball containing (a)
- c) a url that resolves to (b)
- d) a
<name>@<version>
that is published on the registry with (c)
- e) a
<name>@<tag>
that points to (d)
- f) a
<name>
that has a "latest" tag satisfying (e)
- g) a
<git remote url>
that resolves to (b)
Isn't npm brilliant?
edited Jan 14 '15 at 16:31
answered May 3 '12 at 9:39
Colonel Panic
79.5k60295389
79.5k60295389
Note that if you go for option b), it actually has to be a gzipped tarball, a mere zip archive won't do it. I.e. if you create your package withtar -czf my-package.tar.gz dist
(assuming yourdist
folder also has a properpackage.json
file in it), then you cannpm install ../my-lib/my-package.tar.gz
from your other project.
– Dániel Kis-Nagy
Sep 17 at 11:56
add a comment |
Note that if you go for option b), it actually has to be a gzipped tarball, a mere zip archive won't do it. I.e. if you create your package withtar -czf my-package.tar.gz dist
(assuming yourdist
folder also has a properpackage.json
file in it), then you cannpm install ../my-lib/my-package.tar.gz
from your other project.
– Dániel Kis-Nagy
Sep 17 at 11:56
Note that if you go for option b), it actually has to be a gzipped tarball, a mere zip archive won't do it. I.e. if you create your package with
tar -czf my-package.tar.gz dist
(assuming your dist
folder also has a proper package.json
file in it), then you can npm install ../my-lib/my-package.tar.gz
from your other project.– Dániel Kis-Nagy
Sep 17 at 11:56
Note that if you go for option b), it actually has to be a gzipped tarball, a mere zip archive won't do it. I.e. if you create your package with
tar -czf my-package.tar.gz dist
(assuming your dist
folder also has a proper package.json
file in it), then you can npm install ../my-lib/my-package.tar.gz
from your other project.– Dániel Kis-Nagy
Sep 17 at 11:56
add a comment |
up vote
38
down vote
Update January 2016
In addition to other answers, there is sometimes the scenario where you wish to have private modules available in a team context.
Both Github and Bitbucket support the concept of generating a team API Key. This API key can be used as the password to perform API requests as this team.
In your private npm modules add
"private": true
to your package.json
Then to reference the private module in another module, use this in your package.json
{
"name": "myapp",
"dependencies": {
"private-repo":
"git+https://myteamname:aQqtcplwFzlumj0mIDdRGCbsAq5d6Xg4@bitbucket.org/myprivate.git",
}
}
where team name = myteamname, and API Key = aQqtcplwFzlumj0mIDdRGCbsAq5d6Xg4
Here I reference a bitbucket repo, but it is almost identical using github too.
Finally, as an alternative, if you really don't mind paying $7 per month (as of writing) then you can now have private NPM modules out of the box.
Can you use this if you want to have a global module?
– PI.
Jan 13 '16 at 10:31
This does not work for me I am afraid. Both the remote and the repository are not found. Any ideas?
– Thomas Bormans
Feb 3 '16 at 15:50
@ThomasBormans - still having trouble? Please paste (scramble your teamname / api key) what you have as your line in dependencies section of your package.json - as per above instructions. I have found this works well for both github and bitbucket private repos. Which are you using?
– arcseldon
Feb 3 '16 at 17:50
@arcseldon "name": "git+key:x-oauth-basic@bitbucket.org/user/repo.git" returns EISDIR: illegal operation on a directory, read. And "name": "git+user:key@bitbucket.org/repo.git" returns several errors including these words remote: Not Found, fatal: repository, Command failed: git clone. Any ideas?
– Thomas Bormans
Feb 3 '16 at 17:59
Try to follow the "exact" format I have given in answer: "git+https://<myteamname>:<my_key>@bitbucket.org/<my_repo_name>.git How did you generate the API key? Have you double checked it is correct in your bitbucket settings... sorry to ask the obvious, but i have near 100% confidence this should work.
– arcseldon
Feb 3 '16 at 18:09
|
show 7 more comments
up vote
38
down vote
Update January 2016
In addition to other answers, there is sometimes the scenario where you wish to have private modules available in a team context.
Both Github and Bitbucket support the concept of generating a team API Key. This API key can be used as the password to perform API requests as this team.
In your private npm modules add
"private": true
to your package.json
Then to reference the private module in another module, use this in your package.json
{
"name": "myapp",
"dependencies": {
"private-repo":
"git+https://myteamname:aQqtcplwFzlumj0mIDdRGCbsAq5d6Xg4@bitbucket.org/myprivate.git",
}
}
where team name = myteamname, and API Key = aQqtcplwFzlumj0mIDdRGCbsAq5d6Xg4
Here I reference a bitbucket repo, but it is almost identical using github too.
Finally, as an alternative, if you really don't mind paying $7 per month (as of writing) then you can now have private NPM modules out of the box.
Can you use this if you want to have a global module?
– PI.
Jan 13 '16 at 10:31
This does not work for me I am afraid. Both the remote and the repository are not found. Any ideas?
– Thomas Bormans
Feb 3 '16 at 15:50
@ThomasBormans - still having trouble? Please paste (scramble your teamname / api key) what you have as your line in dependencies section of your package.json - as per above instructions. I have found this works well for both github and bitbucket private repos. Which are you using?
– arcseldon
Feb 3 '16 at 17:50
@arcseldon "name": "git+key:x-oauth-basic@bitbucket.org/user/repo.git" returns EISDIR: illegal operation on a directory, read. And "name": "git+user:key@bitbucket.org/repo.git" returns several errors including these words remote: Not Found, fatal: repository, Command failed: git clone. Any ideas?
– Thomas Bormans
Feb 3 '16 at 17:59
Try to follow the "exact" format I have given in answer: "git+https://<myteamname>:<my_key>@bitbucket.org/<my_repo_name>.git How did you generate the API key? Have you double checked it is correct in your bitbucket settings... sorry to ask the obvious, but i have near 100% confidence this should work.
– arcseldon
Feb 3 '16 at 18:09
|
show 7 more comments
up vote
38
down vote
up vote
38
down vote
Update January 2016
In addition to other answers, there is sometimes the scenario where you wish to have private modules available in a team context.
Both Github and Bitbucket support the concept of generating a team API Key. This API key can be used as the password to perform API requests as this team.
In your private npm modules add
"private": true
to your package.json
Then to reference the private module in another module, use this in your package.json
{
"name": "myapp",
"dependencies": {
"private-repo":
"git+https://myteamname:aQqtcplwFzlumj0mIDdRGCbsAq5d6Xg4@bitbucket.org/myprivate.git",
}
}
where team name = myteamname, and API Key = aQqtcplwFzlumj0mIDdRGCbsAq5d6Xg4
Here I reference a bitbucket repo, but it is almost identical using github too.
Finally, as an alternative, if you really don't mind paying $7 per month (as of writing) then you can now have private NPM modules out of the box.
Update January 2016
In addition to other answers, there is sometimes the scenario where you wish to have private modules available in a team context.
Both Github and Bitbucket support the concept of generating a team API Key. This API key can be used as the password to perform API requests as this team.
In your private npm modules add
"private": true
to your package.json
Then to reference the private module in another module, use this in your package.json
{
"name": "myapp",
"dependencies": {
"private-repo":
"git+https://myteamname:aQqtcplwFzlumj0mIDdRGCbsAq5d6Xg4@bitbucket.org/myprivate.git",
}
}
where team name = myteamname, and API Key = aQqtcplwFzlumj0mIDdRGCbsAq5d6Xg4
Here I reference a bitbucket repo, but it is almost identical using github too.
Finally, as an alternative, if you really don't mind paying $7 per month (as of writing) then you can now have private NPM modules out of the box.
edited Jan 13 '16 at 0:11
answered Jan 6 '16 at 11:27
arcseldon
19.4k36888
19.4k36888
Can you use this if you want to have a global module?
– PI.
Jan 13 '16 at 10:31
This does not work for me I am afraid. Both the remote and the repository are not found. Any ideas?
– Thomas Bormans
Feb 3 '16 at 15:50
@ThomasBormans - still having trouble? Please paste (scramble your teamname / api key) what you have as your line in dependencies section of your package.json - as per above instructions. I have found this works well for both github and bitbucket private repos. Which are you using?
– arcseldon
Feb 3 '16 at 17:50
@arcseldon "name": "git+key:x-oauth-basic@bitbucket.org/user/repo.git" returns EISDIR: illegal operation on a directory, read. And "name": "git+user:key@bitbucket.org/repo.git" returns several errors including these words remote: Not Found, fatal: repository, Command failed: git clone. Any ideas?
– Thomas Bormans
Feb 3 '16 at 17:59
Try to follow the "exact" format I have given in answer: "git+https://<myteamname>:<my_key>@bitbucket.org/<my_repo_name>.git How did you generate the API key? Have you double checked it is correct in your bitbucket settings... sorry to ask the obvious, but i have near 100% confidence this should work.
– arcseldon
Feb 3 '16 at 18:09
|
show 7 more comments
Can you use this if you want to have a global module?
– PI.
Jan 13 '16 at 10:31
This does not work for me I am afraid. Both the remote and the repository are not found. Any ideas?
– Thomas Bormans
Feb 3 '16 at 15:50
@ThomasBormans - still having trouble? Please paste (scramble your teamname / api key) what you have as your line in dependencies section of your package.json - as per above instructions. I have found this works well for both github and bitbucket private repos. Which are you using?
– arcseldon
Feb 3 '16 at 17:50
@arcseldon "name": "git+key:x-oauth-basic@bitbucket.org/user/repo.git" returns EISDIR: illegal operation on a directory, read. And "name": "git+user:key@bitbucket.org/repo.git" returns several errors including these words remote: Not Found, fatal: repository, Command failed: git clone. Any ideas?
– Thomas Bormans
Feb 3 '16 at 17:59
Try to follow the "exact" format I have given in answer: "git+https://<myteamname>:<my_key>@bitbucket.org/<my_repo_name>.git How did you generate the API key? Have you double checked it is correct in your bitbucket settings... sorry to ask the obvious, but i have near 100% confidence this should work.
– arcseldon
Feb 3 '16 at 18:09
Can you use this if you want to have a global module?
– PI.
Jan 13 '16 at 10:31
Can you use this if you want to have a global module?
– PI.
Jan 13 '16 at 10:31
This does not work for me I am afraid. Both the remote and the repository are not found. Any ideas?
– Thomas Bormans
Feb 3 '16 at 15:50
This does not work for me I am afraid. Both the remote and the repository are not found. Any ideas?
– Thomas Bormans
Feb 3 '16 at 15:50
@ThomasBormans - still having trouble? Please paste (scramble your teamname / api key) what you have as your line in dependencies section of your package.json - as per above instructions. I have found this works well for both github and bitbucket private repos. Which are you using?
– arcseldon
Feb 3 '16 at 17:50
@ThomasBormans - still having trouble? Please paste (scramble your teamname / api key) what you have as your line in dependencies section of your package.json - as per above instructions. I have found this works well for both github and bitbucket private repos. Which are you using?
– arcseldon
Feb 3 '16 at 17:50
@arcseldon "name": "git+key:x-oauth-basic@bitbucket.org/user/repo.git" returns EISDIR: illegal operation on a directory, read. And "name": "git+user:key@bitbucket.org/repo.git" returns several errors including these words remote: Not Found, fatal: repository, Command failed: git clone. Any ideas?
– Thomas Bormans
Feb 3 '16 at 17:59
@arcseldon "name": "git+key:x-oauth-basic@bitbucket.org/user/repo.git" returns EISDIR: illegal operation on a directory, read. And "name": "git+user:key@bitbucket.org/repo.git" returns several errors including these words remote: Not Found, fatal: repository, Command failed: git clone. Any ideas?
– Thomas Bormans
Feb 3 '16 at 17:59
Try to follow the "exact" format I have given in answer: "git+https://<myteamname>:<my_key>@bitbucket.org/<my_repo_name>.git How did you generate the API key? Have you double checked it is correct in your bitbucket settings... sorry to ask the obvious, but i have near 100% confidence this should work.
– arcseldon
Feb 3 '16 at 18:09
Try to follow the "exact" format I have given in answer: "git+https://<myteamname>:<my_key>@bitbucket.org/<my_repo_name>.git How did you generate the API key? Have you double checked it is correct in your bitbucket settings... sorry to ask the obvious, but i have near 100% confidence this should work.
– arcseldon
Feb 3 '16 at 18:09
|
show 7 more comments
up vote
24
down vote
FWIW: I had problems with all of these answers when dealing with a private organization repository.
The following worked for me:
npm install -S "git+https://username@github.com/orgname/repositoryname.git"
For example:
npm install -S "git+https://blesh@github.com/netflix/private-repository.git"
I'm not entirely sure why the other answers didn't work for me in this one case, because they're what I tried first before I hit Google and found this answer. And the other answers are what I've done in the past.
Hopefully this helps someone else.
2
Can you use a subfolder of the git repo?
– Chris
Oct 10 '14 at 18:28
Not sure, I haven't tried that.
– Ben Lesh
Oct 10 '14 at 20:46
add a comment |
up vote
24
down vote
FWIW: I had problems with all of these answers when dealing with a private organization repository.
The following worked for me:
npm install -S "git+https://username@github.com/orgname/repositoryname.git"
For example:
npm install -S "git+https://blesh@github.com/netflix/private-repository.git"
I'm not entirely sure why the other answers didn't work for me in this one case, because they're what I tried first before I hit Google and found this answer. And the other answers are what I've done in the past.
Hopefully this helps someone else.
2
Can you use a subfolder of the git repo?
– Chris
Oct 10 '14 at 18:28
Not sure, I haven't tried that.
– Ben Lesh
Oct 10 '14 at 20:46
add a comment |
up vote
24
down vote
up vote
24
down vote
FWIW: I had problems with all of these answers when dealing with a private organization repository.
The following worked for me:
npm install -S "git+https://username@github.com/orgname/repositoryname.git"
For example:
npm install -S "git+https://blesh@github.com/netflix/private-repository.git"
I'm not entirely sure why the other answers didn't work for me in this one case, because they're what I tried first before I hit Google and found this answer. And the other answers are what I've done in the past.
Hopefully this helps someone else.
FWIW: I had problems with all of these answers when dealing with a private organization repository.
The following worked for me:
npm install -S "git+https://username@github.com/orgname/repositoryname.git"
For example:
npm install -S "git+https://blesh@github.com/netflix/private-repository.git"
I'm not entirely sure why the other answers didn't work for me in this one case, because they're what I tried first before I hit Google and found this answer. And the other answers are what I've done in the past.
Hopefully this helps someone else.
answered Jun 20 '14 at 21:45
Ben Lesh
95.6k44236226
95.6k44236226
2
Can you use a subfolder of the git repo?
– Chris
Oct 10 '14 at 18:28
Not sure, I haven't tried that.
– Ben Lesh
Oct 10 '14 at 20:46
add a comment |
2
Can you use a subfolder of the git repo?
– Chris
Oct 10 '14 at 18:28
Not sure, I haven't tried that.
– Ben Lesh
Oct 10 '14 at 20:46
2
2
Can you use a subfolder of the git repo?
– Chris
Oct 10 '14 at 18:28
Can you use a subfolder of the git repo?
– Chris
Oct 10 '14 at 18:28
Not sure, I haven't tried that.
– Ben Lesh
Oct 10 '14 at 20:46
Not sure, I haven't tried that.
– Ben Lesh
Oct 10 '14 at 20:46
add a comment |
up vote
7
down vote
I had this same problem, and after some searching around, I found Reggie (https://github.com/mbrevoort/node-reggie). It looks pretty solid. It allows for lightweight publishing of NPM modules to private servers. Not perfect (no authentication upon installation), and it's still really young, but I tested it locally, and it seems to do what it says it should do.
That is... (and this just from their docs)
npm install -g reggie
reggie-server -d ~/.reggie
then cd into your module directory and...
reggie -u http://<host:port> publish
reggie -u http://127.0.0.1:8080 publish
finally, you can install packages from reggie just by using that url either in a direct npm install command, or from within a package.json... like so
npm install http://<host:port>/package/<name>/<version>
npm install http://<host:port>/package/foo/1.0.0
or..
dependencies: {
"foo": "http://<host:port>/package/foo/1.0.0"
}
add a comment |
up vote
7
down vote
I had this same problem, and after some searching around, I found Reggie (https://github.com/mbrevoort/node-reggie). It looks pretty solid. It allows for lightweight publishing of NPM modules to private servers. Not perfect (no authentication upon installation), and it's still really young, but I tested it locally, and it seems to do what it says it should do.
That is... (and this just from their docs)
npm install -g reggie
reggie-server -d ~/.reggie
then cd into your module directory and...
reggie -u http://<host:port> publish
reggie -u http://127.0.0.1:8080 publish
finally, you can install packages from reggie just by using that url either in a direct npm install command, or from within a package.json... like so
npm install http://<host:port>/package/<name>/<version>
npm install http://<host:port>/package/foo/1.0.0
or..
dependencies: {
"foo": "http://<host:port>/package/foo/1.0.0"
}
add a comment |
up vote
7
down vote
up vote
7
down vote
I had this same problem, and after some searching around, I found Reggie (https://github.com/mbrevoort/node-reggie). It looks pretty solid. It allows for lightweight publishing of NPM modules to private servers. Not perfect (no authentication upon installation), and it's still really young, but I tested it locally, and it seems to do what it says it should do.
That is... (and this just from their docs)
npm install -g reggie
reggie-server -d ~/.reggie
then cd into your module directory and...
reggie -u http://<host:port> publish
reggie -u http://127.0.0.1:8080 publish
finally, you can install packages from reggie just by using that url either in a direct npm install command, or from within a package.json... like so
npm install http://<host:port>/package/<name>/<version>
npm install http://<host:port>/package/foo/1.0.0
or..
dependencies: {
"foo": "http://<host:port>/package/foo/1.0.0"
}
I had this same problem, and after some searching around, I found Reggie (https://github.com/mbrevoort/node-reggie). It looks pretty solid. It allows for lightweight publishing of NPM modules to private servers. Not perfect (no authentication upon installation), and it's still really young, but I tested it locally, and it seems to do what it says it should do.
That is... (and this just from their docs)
npm install -g reggie
reggie-server -d ~/.reggie
then cd into your module directory and...
reggie -u http://<host:port> publish
reggie -u http://127.0.0.1:8080 publish
finally, you can install packages from reggie just by using that url either in a direct npm install command, or from within a package.json... like so
npm install http://<host:port>/package/<name>/<version>
npm install http://<host:port>/package/foo/1.0.0
or..
dependencies: {
"foo": "http://<host:port>/package/foo/1.0.0"
}
answered Nov 16 '13 at 23:04
bwest87
960911
960911
add a comment |
add a comment |
up vote
6
down vote
Structure your code in an accessible fashion like below. If this is possible for you.
NodeProjsAppsMainApppackage.json
NodeProjsModulesDataModulepackage.json
Within MainApp @ NodProjsAppsMainApp
npm install --S ../../Modules/DataModule
You may need to update package.json as:
"dependencies": {
"datamodule": "../../Modules/DataModule"
}
This worked for my situation.
add a comment |
up vote
6
down vote
Structure your code in an accessible fashion like below. If this is possible for you.
NodeProjsAppsMainApppackage.json
NodeProjsModulesDataModulepackage.json
Within MainApp @ NodProjsAppsMainApp
npm install --S ../../Modules/DataModule
You may need to update package.json as:
"dependencies": {
"datamodule": "../../Modules/DataModule"
}
This worked for my situation.
add a comment |
up vote
6
down vote
up vote
6
down vote
Structure your code in an accessible fashion like below. If this is possible for you.
NodeProjsAppsMainApppackage.json
NodeProjsModulesDataModulepackage.json
Within MainApp @ NodProjsAppsMainApp
npm install --S ../../Modules/DataModule
You may need to update package.json as:
"dependencies": {
"datamodule": "../../Modules/DataModule"
}
This worked for my situation.
Structure your code in an accessible fashion like below. If this is possible for you.
NodeProjsAppsMainApppackage.json
NodeProjsModulesDataModulepackage.json
Within MainApp @ NodProjsAppsMainApp
npm install --S ../../Modules/DataModule
You may need to update package.json as:
"dependencies": {
"datamodule": "../../Modules/DataModule"
}
This worked for my situation.
answered Sep 14 '16 at 20:32
wchoward
1,5091924
1,5091924
add a comment |
add a comment |
up vote
3
down vote
Starting with arcseldon's answer, I found that the team name was needed in the URL like so:
npm install --save "git+https://myteamname@aQqtcplwFzlumj0mIDdRGCbsAq5d6Xg4@bitbucket.org/myteamname/myprivate.git"
And note that the API key is only available for the team, not individual users.
add a comment |
up vote
3
down vote
Starting with arcseldon's answer, I found that the team name was needed in the URL like so:
npm install --save "git+https://myteamname@aQqtcplwFzlumj0mIDdRGCbsAq5d6Xg4@bitbucket.org/myteamname/myprivate.git"
And note that the API key is only available for the team, not individual users.
add a comment |
up vote
3
down vote
up vote
3
down vote
Starting with arcseldon's answer, I found that the team name was needed in the URL like so:
npm install --save "git+https://myteamname@aQqtcplwFzlumj0mIDdRGCbsAq5d6Xg4@bitbucket.org/myteamname/myprivate.git"
And note that the API key is only available for the team, not individual users.
Starting with arcseldon's answer, I found that the team name was needed in the URL like so:
npm install --save "git+https://myteamname@aQqtcplwFzlumj0mIDdRGCbsAq5d6Xg4@bitbucket.org/myteamname/myprivate.git"
And note that the API key is only available for the team, not individual users.
edited May 23 '17 at 10:31
Community♦
11
11
answered Aug 9 '16 at 19:26
neonhomer
32428
32428
add a comment |
add a comment |
up vote
2
down vote
Npm now provides unlimited private hosted modules for $7/user/month used like so
cd private-project
npm login
in your package json set "name": " @username/private-project"
npm publish
then to require your project:
cd ../new-project
npm install --save @username/private-project
Does this require a client-side login step?
– Aidan Hoolachan
Dec 16 '17 at 2:22
What's an alternative to this? For example, if you want to host your "package" on S3 and pull from there.
– Con Antonakos
Nov 27 at 22:19
add a comment |
up vote
2
down vote
Npm now provides unlimited private hosted modules for $7/user/month used like so
cd private-project
npm login
in your package json set "name": " @username/private-project"
npm publish
then to require your project:
cd ../new-project
npm install --save @username/private-project
Does this require a client-side login step?
– Aidan Hoolachan
Dec 16 '17 at 2:22
What's an alternative to this? For example, if you want to host your "package" on S3 and pull from there.
– Con Antonakos
Nov 27 at 22:19
add a comment |
up vote
2
down vote
up vote
2
down vote
Npm now provides unlimited private hosted modules for $7/user/month used like so
cd private-project
npm login
in your package json set "name": " @username/private-project"
npm publish
then to require your project:
cd ../new-project
npm install --save @username/private-project
Npm now provides unlimited private hosted modules for $7/user/month used like so
cd private-project
npm login
in your package json set "name": " @username/private-project"
npm publish
then to require your project:
cd ../new-project
npm install --save @username/private-project
edited Jun 3 '15 at 6:23
answered Jun 3 '15 at 6:11
roo2
4,59322138
4,59322138
Does this require a client-side login step?
– Aidan Hoolachan
Dec 16 '17 at 2:22
What's an alternative to this? For example, if you want to host your "package" on S3 and pull from there.
– Con Antonakos
Nov 27 at 22:19
add a comment |
Does this require a client-side login step?
– Aidan Hoolachan
Dec 16 '17 at 2:22
What's an alternative to this? For example, if you want to host your "package" on S3 and pull from there.
– Con Antonakos
Nov 27 at 22:19
Does this require a client-side login step?
– Aidan Hoolachan
Dec 16 '17 at 2:22
Does this require a client-side login step?
– Aidan Hoolachan
Dec 16 '17 at 2:22
What's an alternative to this? For example, if you want to host your "package" on S3 and pull from there.
– Con Antonakos
Nov 27 at 22:19
What's an alternative to this? For example, if you want to host your "package" on S3 and pull from there.
– Con Antonakos
Nov 27 at 22:19
add a comment |
up vote
1
down vote
Config to install from public Github repository, even if machine is under firewall:
dependencies: {
"foo": "https://github.com/package/foo/tarball/master"
}
add a comment |
up vote
1
down vote
Config to install from public Github repository, even if machine is under firewall:
dependencies: {
"foo": "https://github.com/package/foo/tarball/master"
}
add a comment |
up vote
1
down vote
up vote
1
down vote
Config to install from public Github repository, even if machine is under firewall:
dependencies: {
"foo": "https://github.com/package/foo/tarball/master"
}
Config to install from public Github repository, even if machine is under firewall:
dependencies: {
"foo": "https://github.com/package/foo/tarball/master"
}
answered Mar 4 '15 at 10:59
Alex Belozerov
38129
38129
add a comment |
add a comment |
up vote
1
down vote
I use the following with a private github repository:
npm install github:mygithubuser/myproject
add a comment |
up vote
1
down vote
I use the following with a private github repository:
npm install github:mygithubuser/myproject
add a comment |
up vote
1
down vote
up vote
1
down vote
I use the following with a private github repository:
npm install github:mygithubuser/myproject
I use the following with a private github repository:
npm install github:mygithubuser/myproject
answered Feb 14 '17 at 20:58
Lars
8,27232332
8,27232332
add a comment |
add a comment |
up vote
0
down vote
Very simple -
npm config set registry https://path-to-your-registry/
It actually sets registry = "https://path-to-your-registry"
this line to /Users/<ur-machine-user-name>/.npmrc
All the value you have set explicitly or have been set by default can be seen by - npm config list
add a comment |
up vote
0
down vote
Very simple -
npm config set registry https://path-to-your-registry/
It actually sets registry = "https://path-to-your-registry"
this line to /Users/<ur-machine-user-name>/.npmrc
All the value you have set explicitly or have been set by default can be seen by - npm config list
add a comment |
up vote
0
down vote
up vote
0
down vote
Very simple -
npm config set registry https://path-to-your-registry/
It actually sets registry = "https://path-to-your-registry"
this line to /Users/<ur-machine-user-name>/.npmrc
All the value you have set explicitly or have been set by default can be seen by - npm config list
Very simple -
npm config set registry https://path-to-your-registry/
It actually sets registry = "https://path-to-your-registry"
this line to /Users/<ur-machine-user-name>/.npmrc
All the value you have set explicitly or have been set by default can be seen by - npm config list
edited Jul 27 '17 at 9:05
answered Jul 11 '17 at 7:14
sapy
2,61922531
2,61922531
add a comment |
add a comment |
up vote
0
down vote
This was what I was looking for:
# Get the latest from GitHub, public repo:
$ npm install username/my-new-project --save-dev
# Bitbucket, private repo:
$ npm install git+https://token:x-oauth-basic@github.com/username/my-new-project.git#master
$ npm install git+ssh://git@github.com/username/my-new-project.git#master
# … or from Bitbucket, public repo:
$ npm install git+ssh://git@bitbucket.org/username/my-new-project.git#master --save-dev
# Bitbucket, private repo:
$ npm install git+https://username:password@bitbucket.org/username/my-new-project.git#master
$ npm install git+ssh://git@bitbucket.org/username/my-new-project.git#master
# Or, if you published as npm package:
$ npm install my-new-project --save-dev
add a comment |
up vote
0
down vote
This was what I was looking for:
# Get the latest from GitHub, public repo:
$ npm install username/my-new-project --save-dev
# Bitbucket, private repo:
$ npm install git+https://token:x-oauth-basic@github.com/username/my-new-project.git#master
$ npm install git+ssh://git@github.com/username/my-new-project.git#master
# … or from Bitbucket, public repo:
$ npm install git+ssh://git@bitbucket.org/username/my-new-project.git#master --save-dev
# Bitbucket, private repo:
$ npm install git+https://username:password@bitbucket.org/username/my-new-project.git#master
$ npm install git+ssh://git@bitbucket.org/username/my-new-project.git#master
# Or, if you published as npm package:
$ npm install my-new-project --save-dev
add a comment |
up vote
0
down vote
up vote
0
down vote
This was what I was looking for:
# Get the latest from GitHub, public repo:
$ npm install username/my-new-project --save-dev
# Bitbucket, private repo:
$ npm install git+https://token:x-oauth-basic@github.com/username/my-new-project.git#master
$ npm install git+ssh://git@github.com/username/my-new-project.git#master
# … or from Bitbucket, public repo:
$ npm install git+ssh://git@bitbucket.org/username/my-new-project.git#master --save-dev
# Bitbucket, private repo:
$ npm install git+https://username:password@bitbucket.org/username/my-new-project.git#master
$ npm install git+ssh://git@bitbucket.org/username/my-new-project.git#master
# Or, if you published as npm package:
$ npm install my-new-project --save-dev
This was what I was looking for:
# Get the latest from GitHub, public repo:
$ npm install username/my-new-project --save-dev
# Bitbucket, private repo:
$ npm install git+https://token:x-oauth-basic@github.com/username/my-new-project.git#master
$ npm install git+ssh://git@github.com/username/my-new-project.git#master
# … or from Bitbucket, public repo:
$ npm install git+ssh://git@bitbucket.org/username/my-new-project.git#master --save-dev
# Bitbucket, private repo:
$ npm install git+https://username:password@bitbucket.org/username/my-new-project.git#master
$ npm install git+ssh://git@bitbucket.org/username/my-new-project.git#master
# Or, if you published as npm package:
$ npm install my-new-project --save-dev
answered Nov 20 at 7:27
Isaiah
165112
165112
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f10386310%2fhow-to-install-a-private-npm-module-without-my-own-registry%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown