"Error: Cannot find module 'node-fetch'" when deploying function

hi @jhull, do you have your function dependencies in a package.json inside the function folder? If so, our buildbot will not automatically run npm install in those folders. You’ll need to add something like cd path_where_function lives/ && npm install && rest of your build command. This will ensure your dependencies are installed.

Our buildbot only runs npm install (or yarn install) for the root package.json. That’s why that added step is needed. You can, instead, have your function dependencies in your main package.json, then you can leave your build command as-is and things should still work.

2 Likes