Reputation: 4802
I'm using the rc-slider component in my application and had to add one feature to meet my needs.
I forked the main repository and pushed my changes to this branch.
In the application, I changed the package.json
as below and ran the npm install again:
"rc-slider": "Rodrigora/slider#add-label"
Nothing changed. Seems that npm doesn't update the dependencies.
So, I removed the node_modules
and rails cache folder and ran the install command again:
rm -rf node_modules/
rake tmp:cache:clear
npm install
Now, I have this error:
events.js:142
throw er; // Unhandled 'error' event
^
Error: Cannot find module 'rc-slider' from '/Users/rodrigora/project/app/assets/javascripts'
NPM can't find the rc-slider
when I using the modified branch.
package.json
file?Upvotes: 8
Views: 591
Reputation: 1138
In npm docs:
"dependencies": {
"rc-slider": "git://github.com/Rodrigora/slider.git#add-label"
}
Also you can use
npm install git://github.com/Rodrigora/slider.git#add-label --save
The above command will add that dependency in your package.json
.
Edit:
I miss understood your question. I tried the below fix in the repo that you mentioned and it worked. (you should also have the dependency setup like above)
It is a react project. It is compiled and published to NPM.
So, if you want to install it directly from your github fork, you should make some changes to package.json
Before making changes in package.json
install rc-tools globaly:
sudo npm install rc-tools -g
Change the files that should be included:
"files": [
"index.js",
"assets",
"src"
]
and add postinstall
script in scripts:
"postinstall": "rc-tools run compile"
Then try installing from github after making these changes in that branch.
Upvotes: 4
Reputation: 4199
You can use git repositories as NPM packages:
"rc-slider": "git://github.com/Rodrigora/slider#add-label"
Upvotes: 2