Other popular posts
Previously this week we showed how to deploy to the Nodejitsu PaaS using a private npm registry. Not using the Nodejitsu PaaS? No problem: you can also deploy using a private npm registry to Heroku!
If you already have a Heroku app this is simple. If not, why don't you checkout their getting started documentation. First (just like before) we recommend you create a specific deploy user for your private npm registry first. This allows you to separate access control from the personal accounts of the developers on your team.
npm config set https://<your-subdomain>.registry.nodejitsu.com npm adduser # Enter new credentials for your # own deployment user.
Ensure you add this user to your private npm account at
https://<your-subdomain>.npm.nodejitsu.com and you're ready to go!
Now that we have your private npm deploy user created and added to your registry we just need to add a
.npmrc file to the root directory of your application. Follow along below:
1. Backup your existing personal
cp ~/.npmrc ~/.npmrc-local
2. Login with your deploy user
npm login --registry https://registry.nodejitsu.com # Enter the credentials for your deploy user
3. Copy your current
.npmrc to your Heroku application
cp ~/.npmrc path/to/application git add . git commit -m 'Add private .npmrc' git push heroku master
4. Restore your personal
mv ~/.npmrc-local ~/.npmrc
And ... voila!
- All of your private npm dependencies for your project you will be seamlessly installed for every deployment of your Heroku application.
- You'll always be able to deploy during public npm downtime since you're now using our bifurcated and dedicated public replica: https://registy.nodejitsu.com
If this sounds too easy then we've done our job right! Ready to try it out? Great! You can signup for your private npm registry at https://www.nodejitsu.com/signup. Plans start at just $25.