cloud-functions-emulator icon indicating copy to clipboard operation
cloud-functions-emulator copied to clipboard

Add support for private npm modules

Open mderazon opened this issue 8 years ago • 3 comments

Steps to reproduce

  1. Include a private module in package.json. i.e. @org/name
  2. Throws an error when deploying: Error: Cannot find module '@org/name'

Including .npmrc file at the root folder doesn't help. (https://docs.npmjs.com/private-modules/ci-server-config#checking-in-your-npmrc)

Also see here:

  • http://stackoverflow.com/questions/42901076/how-to-use-private-npm-packages-with-cloud-functions
  • https://issuetracker.google.com/issues/36665861

mderazon avatar Mar 28 '17 09:03 mderazon

Hi guys. Is anyone working on this? Need to use this functionality ASAP.

akshayapte avatar Nov 08 '17 09:11 akshayapte

Hello, are there any updates on this? This would be much needed indeed.

WaldoJeffers avatar Dec 05 '17 13:12 WaldoJeffers

This is now supported 🎉

In order to use a private npm module, you have to provide credentials (auth token) for the npm registry in a .npmrc file located in the function's directory. You can simply copy the .npmrc file that was created in your home directory when you logged into npm using the npm login command.

Do not include the .npmrc file if you're not using private repositories, as it may increase the deployment time for your functions.

Source: https://cloud.google.com/functions/docs/writing/dependencies#using_private_modules

mikenikles avatar Dec 20 '17 05:12 mikenikles