The npm installation from GitHub is quite useful for testing packages. It also gives the flexibility to install any specific branch, version, tag, and so on.
Add the GitHub repository URL there: "repository": { "type": "git", "url": "https://github.com/your-user/repo-url.git" }, Make sure you specify git as type and that the URL is pointing to the actual repository, not an HTML page. So the URL has to end with .
There are extra square brackets in the command you tried.
To install the latest version from the brach-name
branch, you can use:
npm install "https://github.com/shakacode/bootstrap-loader.git#branch-name" --save
Just do:
npm install username/repo#branchName --save
e.g. (my username is betimer)
npm i betimer/rtc-attach#master --save
// this will appear in your package.json:
"rtc-attach": "github:betimer/rtc-attach#master"
One thing I also want to mention: it's not a good idea to check in the package.json for the build server auto pull the change. Instead, put the npm i (first command) into the build command, and let server just install and replace the package.
One more note, if the package.json private is set to true, may impact sometimes.
you can give git pattern as version, yarn and npm are clever enough to resolve from a git repo.
yarn add any-package@user-name/repo-name#branch-name
or for npm
npm install --save any-package@user-name/repo-name#branch-name
Another approach would be to add the following line to package.json
dependencies:
"package-name": "user/repo#branch"
For example:
"dependencies": {
... other dependencies ...
"react-native": "facebook/react-native#master"
}
And then do npm install
or yarn install
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With