Skip to content Skip to sidebar Skip to footer

Unable To Modify And Test A Forked Github Library - Npm Err! Version Not Found

I am a noobie with all this Github forking-pull-request lifecycle. What I want to do is fork a repository, make some changes and try them on a project before submitting a pull req

Solution 1:

Although nwinkers solution is more convenient I am posting this as an alternative:

  1. Push your forked-library changes to GitHub.
  2. In your GitHub forked-library page, at the right side, get the URL pointed at by the Download ZIP button, replace archive for tarball and remove the .zip extension. For instance: https://github.com/somebody/forked-library/archive/master.zip => https://github.com/somebody/forked-library/tarball/master.
  3. Change the version of the forked-library in your text-project's package.json to point at the modified URL you got in step 2: https://github.com/somebody/forked-library/tarball/master

Now you can do npm install in test-project and work against the patched lib.

Solution 2:

The npm install command will always try to find a released version from the npm registry. Since you're still in development, it will not find it there.

To work around this, you can use the npm link command - which will set up a symbolic link to your local development version.

Here's how to use it:

# CD to the forked-library projectcd ~/forked-library

# Call npm link to create a global link
npm link# CD to the test projectcd ~/test-project

# Call npm link to link the development version to this project
npm link forked-library

After doing that, you should have a symbolic link to your local forked-library folder from the test-project/node_modules folder.

This will allow you to use the development version without releasing it. You can make changes in the forked library and they will be visible immediately in your test project.

Here's the npm link documentation.

Post a Comment for "Unable To Modify And Test A Forked Github Library - Npm Err! Version Not Found"