I would like to install a node package directly from github.
I am able to use a command like this:
npm install git://github.com/codeine-cd/codeineNodePeer.git#V0.0.1
However, I would like to use the latest release, I have a tag for that but I cant write it in the git url (like #latest)
Is it possible to do that any other way?
Related
Instead of installing the latest version of an NPM package using
npm install x#latest
is there a way to view the latest stable version? something like this:
npm view x#stable version
I am looking for a programmatic/command line solution.
https://docs.npmjs.com/cli/view
Utilizing the following syntax returns the semver/value of the latest stable version only:
npm view <name> dist-tags.latest
You'll need to replace the <name> part with the actual package name.
Example:
npm view babel-cli dist-tags.latest
Running the command above currently prints 6.26.0 to the console, whilst the latest non-stable version available is the npm registry is currently 7.0.0-beta.3
Notes:
The command above will report the same version which would get installed when running:
npm install <name>#latest
Caveat: For either of the two commands to get the truly stable latest version they are reliant on the author/owner of the package having correctly managed their dist-tags. An excerpt from the docs (at the link provided) reads:
Publishing a package sets the latest tag to the published version unless the --tag option is used. For example, npm publish --tag=beta.
The problem is that if I use a command like so:
npm install -g github:user/repo#branch_x
It will not install the latest package represented by that branch_x. I currently am guessing that it just uses the master branch. But I would like to install based off of a branch other than master.
I just opened this issue with NPM
https://github.com/npm/npm/issues/17623
Has anyone seen the same issue? Anyone know a workaround?
I have a beginner question concerning nodejs.
I'm working on two different nodejs projects, let's say project A and project B.
And I would like to use the functionalities of project A in B.
How can I do it??
I was thinking about using git submodules. But is there a possibility to use project A as a node_module. that means that the users only have to update it if a new version of it is available?
Thank you
No need to use git submodules - you can use npm to install a module directly from a git remote url, or directly from GitHub.
e.g.:
npm install <git remote url>
npm install githubname/reponame
See the npm install docs for details.
I would like to develop a chatbot and then chose botkit as the tool to use. Following the steps to install it as described here,I first cloned the repository to my local disk D: this worked but the second step command (for Installing dependencies, including Botkit:)
cd botkit-starter-facebook
npm install
doesn't work giving me the error :
I don't understand what that means so it is hard for me to solve it.
I am using windows 7 x64bits pack 1 and node version 6.9.5 and npm version 3.10.10
Git was not in the path system environment variable and I add it but I am still getting the same error.
This is probably because git is not installed or not in the path. npm is trying to pull some dependency from github but unable to clone it as git is not available. Once you have git working, this should work.
The problem drove me crazy, there is a package in npm database, but it has some bugs, which are already fixed in github, how could I make use of the fixed version(github version)?
Edit:
You can install directly from the GitHub repository, even just using the GitHub username and the repository name:
npm install LearnBoost/socket.io
You can also add a <commit-ish>, specifying e.g. a commit hash or a version tag, like so:
npm install LearnBoost/socket.io#1.7.x
Without a protocol, this will be interpreted as git://github.com/LearnBoost/socket.io. You can also prefix the repo with gitlab:, gist: or bitbucket:, respectively. For more information, see Using git URLs as dependencies.
You can install directly from a URL, example:
npm install https://github.com/LearnBoost/socket.io/tarball/master
You can find the URL on Github under "Downloads" on any project page. Select the "Download as tar.gz" link.
Or you can install a tarball:
npm install foo.tar.gz
See npm install(1).
Edit:
I should mention that this works equally well in package.json files. Specify the URL instead of the version in your dependencies, like so:
...
"dependencies": {
"foo": "http://example.com/foo.tar.gz",
"bar": "1.2.x",
...
}
Other temporary solution, get the github project and use npm link (http://npmjs.org/doc/link.html) to link the local folder obtained through git to your node_modules folder in your own project. Anyway in the end, you'll have to wait for the project maintainer to do a npm publish.
Either add the module as a git sub-module (using git submodule) to your project or tell the module maintainer to update the version and trigger a npm publish to update the npm repository.
When using the sub-module way, be aware that you cannot update the reference using npm-commands.