How to use fork version of npm package in a project

Viewed 19689

Let's say there is an npm package called abcd. Normally in package.json, we specified the dependencies as "abcd": "^1.0.0",

But this abcd does not work as expected, so I forked (and modified) it inside https://github.com/mygithubid/abcd

Then I run npm install git+https://git@github.com/mygithubid/abcd.git and in package.json, the definition is changed to "abcd": "git+https://github.com/mygithubid/abcd.git",

After restarting the project that using this abcd, now it throws error Module not found: Can't resolve 'abcd' ... even though I saw the abcd folder is added inside node_modules

Could you advise the mistake I made in above? Thanks!

2 Answers

Be sure that the github repository contains compiled files, at most cases you need build the package for npm first, the compiled files push only to NPM. To find out how to build the package check the package.json file

Related