Unable To Modify And Test A Forked Github Library - Npm Err! Version Not Found
Solution 1:
Although nwinkers solution is more convenient I am posting this as an alternative:
- Push your
forked-library
changes to GitHub. - 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
. - Change the version of the
forked-library
in yourtext-project
'spackage.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"