Utilize Customized npm Package from GitHub Branch
Utilize Customized npm Package from GitHub Branch
When working with npm libraries there are times you find bugs or want to add functionality to a library. You could just modify the files locally and run the application but this gets tricky when you go to deploy an application and it does an npm install which doesn’t include your changes.
If the project is out there on GitHub there is a better way.
- Fork the project on Github to your account.
- Create a new branch from your fork.
- Fix the bug or add the functionality you want.
- Uninstall the original npm package by opening a terminal within the directory of your project and running the following command.
npm uninstall <package-name>
Example
npm uninstall node-simple-odata-server
- Install the npm package from your Forked branch using the following command from a terminal within your project directory.
npm install --save <your-github-user>/<repository-name>#<branch-name>
Example
npm install --save rwilson504/node-simple-odata-server#Add-Nullable
- Make sure to create a pull request if possible from your branch to the original authors project so that they could include your fixes or functionality in the original project.
Comments
Post a Comment