0

I have done some changes inside node_modules folder inside a module and run NPM install again inside a module in node_modules. It's working fine on local.

Now, I want to deploy it on Heroku. But Heroku looks at the package.json file and installs all the NPM modules again.

So, Please let me know "How can I deploy local node_modules folder onto Heroku" and prevent Heroku to NPM install again.

bugfreerammohan
  • 1,443
  • 1
  • 5
  • 18
  • Easier way: fork the module you are modifying, and point your `package.json` to your version instead. You can do it even with [private repositories](https://stackoverflow.com/questions/23210437/npm-install-private-github-repositories-by-dependency-in-package-json). – Amadan Apr 11 '19 at 05:08
  • Thanks for your quick response @Amadan. Can you please provide any reference for that? –  Apr 11 '19 at 05:11
  • I did. That's what the link was for. Unless you're asking how to fork a repository...? – Amadan Apr 11 '19 at 05:11
  • Find the repository of the package on GitHub using `npm view repository.url`. Use [GitHub Help on forking](https://help.github.com/en/articles/fork-a-repo) to perform the fork. Then you'll need to `checkout` the fork, make your changes, `add` and `commit` them, and `push` them back to GitHub (the relevant help pages are easy to find, and knowing how to use Git is super-useful for any programmer these days anyway). – Amadan Apr 11 '19 at 05:20
  • Secrets like credentials belong in environment variables, not in committed code. – Amadan Apr 11 '19 at 05:21
  • So, Will my fork be publicly available to anyone? –  Apr 11 '19 at 05:21
  • If you set it to public, yes. If you set it to private, no. Again, see my first link to see how to link a private repository. However, again, things like credentials do not belong in code, and should not be committed, private repo or not. – Amadan Apr 11 '19 at 05:23
  • @Amadan, Please let me know "Can I set the custom url for a npm package" inside package.json? –  Apr 11 '19 at 05:45
  • Seriously, for the third time, there's examples for that in the link in my first comment here. – Amadan Apr 11 '19 at 05:49
  • Sorry I read it now. –  Apr 11 '19 at 05:52
  • Last thing, I am creating a Public repo so that I can provide the link in package.json, So do i need to push node_modules folder onto repo? –  Apr 11 '19 at 05:54
  • OP, is this also you? https://stackoverflow.com/users/9417293/rajat Why are you using multiple accounts? You seem to be asking the same thing over and over with at least two accounts, and I [already provided an answer at least once](https://stackoverflow.com/a/55617204/354577). Please don't ask the same question many times. – Chris Apr 11 '19 at 12:39
  • Possible duplicate of [Deploy customized Node.js module on Heroku](https://stackoverflow.com/questions/55610759/deploy-customized-node-js-module-on-heroku) – Chris Apr 11 '19 at 12:40
  • @Chris, No I am only using one account.. –  Apr 11 '19 at 16:42
  • @test, strange, since you comment on [this answer](https://stackoverflow.com/a/55625558/354577) as if you're [Rajat](https://stackoverflow.com/users/9417293/rajat). – Chris Apr 11 '19 at 16:47
  • I think username on SO can be same. –  Apr 12 '19 at 04:34

0 Answers0