-
Notifications
You must be signed in to change notification settings - Fork 235
Description
Environment details
- OS: macOS 10.14.5
- Node.js version: 8.13.x
- npm version: 6.4.1
@google-cloud/pubsubversion: 0.30.0
Steps to reproduce
(I noticed this when deploying cloud functions)
- npm install @google-cloud/pubsub
- import and use the library
- deploy functions.
Result:
Deployment error.
Function failed on loading user code. Error message: Code in file index.js can't be loaded.
Did you list all required modules in the package.json dependencies?
Detailed stack trace: Error: Cannot find module '@grpc/grpc-js'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object. (/srv/node_modules/@google-cloud/pubsub/build/src/pubsub.js:24:14)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
Looking at the @google-cloud/pubsub module that was installed in my node_modules folder I noticed that while it requires @grpc/grpc-js in @google-cloud/pubsub/build/src/pubsub.js:24:14 but it is not listed in the package.json and does not exist inside of its node_modules folder.
This seemed weird so I added @grpcs/grpc-js as a dependency of my project and everything is working fine now.
If I am correct about this I am very happy to open a pull request with the dependency added.
Thanks!