Does Netlify lack support for googleapis?

Did you use the search before posting? Yes, and I saw some people had issues with Googleapis before but for lambda functions but there was no clear confirmation on wether netlify lack support or if there is a special configuration required.
What about reading through our Common Issues? I did

Issue: Gatsby build fails when including googleapis (googleapis - npm) in a plugin. Why? Works on the local machine.

Build log:

2:29:36 PM: Executing user command: gatsby build
2:29:39 PM: success open and validate gatsby-configs - 0.031s
2:29:39 PM: error Error in “/opt/build/repo/plugins/gatsby-source-fixer/gatsby-node.js”: Cannot find module ‘googleapis’
2:29:39 PM:
2:29:39 PM: Error: Cannot find module ‘googleapis’
2:29:39 PM:
2:29:39 PM: - loader.js:636 Function.Module._resolveFilename
2:29:39 PM: internal/modules/cjs/loader.js:636:15
2:29:39 PM:
2:29:39 PM: - loader.js:562 Function.Module._load
2:29:39 PM: internal/modules/cjs/loader.js:562:25
2:29:39 PM:
2:29:39 PM: - loader.js:692 Module.require
2:29:39 PM: internal/modules/cjs/loader.js:692:17
2:29:39 PM:
2:29:39 PM: - v8-compile-cache.js:159 require
2:29:39 PM: [repo]/[v8-compile-cache]/v8-compile-cache.js:159:20
2:29:39 PM:
2:29:39 PM: - gatsby-node.js:5 Object.
2:29:39 PM: /opt/build/repo/plugins/gatsby-source-fixer/gatsby-node.js:5:20
2:29:39 PM:
2:29:39 PM: - v8-compile-cache.js:178 Module._compile
2:29:39 PM: [repo]/[v8-compile-cache]/v8-compile-cache.js:178:30
2:29:39 PM:
2:29:39 PM: - loader.js:789 Object.Module._extensions…js
2:29:39 PM: internal/modules/cjs/loader.js:789:10
2:29:39 PM:
2:29:39 PM: - loader.js:653 Module.load
2:29:39 PM: internal/modules/cjs/loader.js:653:32
2:29:39 PM:
2:29:39 PM: - loader.js:593 tryModuleLoad
2:29:39 PM: internal/modules/cjs/loader.js:593:12
2:29:39 PM:
2:29:39 PM: - loader.js:585 Function.Module._load
2:29:39 PM: internal/modules/cjs/loader.js:585:3
2:29:39 PM:
2:29:39 PM: - loader.js:692 Module.require
2:29:39 PM: internal/modules/cjs/loader.js:692:17
2:29:39 PM:
2:29:39 PM: - v8-compile-cache.js:159 require
2:29:39 PM: [repo]/[v8-compile-cache]/v8-compile-cache.js:159:20
2:29:39 PM:
2:29:39 PM: - resolve-module-exports.js:126 module.exports
2:29:39 PM: [repo]/[gatsby]/dist/bootstrap/resolve-module-exports.js:126:26
2:29:39 PM:
2:29:39 PM: - validate.js:120 flattenedPlugins.forEach.plugin
2:29:39 PM: [repo]/[gatsby]/dist/bootstrap/load-plugins/validate.js:120:31
2:29:39 PM:
2:29:39 PM: - Array.forEach
2:29:39 PM:
2:29:39 PM: - validate.js:113 collatePluginAPIs
2:29:39 PM: [repo]/[gatsby]/dist/bootstrap/load-plugins/validate.js:113:20
2:29:39 PM:
2:29:39 PM:
2:29:39 PM: not finished load plugins - 0.710s

Nevermind. I found the solution. For others googling the same issue: dependencies in package.json in a plugin is not picked up automatically. You must also install the depencies in your gatsby site and not only in the plugin folder.

1 Like

Thanks so much for posting that solution, Victor! Really love when folks follow up after finding the solution!