Reputation: 5422
I have dependency to Cloud Tasks in my index.js file: const {CloudTasksClient} = require("@google-cloud/tasks")
. But when I try to deploy my cloud function using Tasks, it's complete with the error: Detailed stack trace: Error: Cannot find module '@google-cloud/tasks'
. Then I ran again npm install @google-cloud/tasks
and console say no errors, it looks as succeed. When I check my package.json and package-lock.json files, they do not contain anything about @google-cloud/tasks. Any thoughts? Thanks.
Upvotes: 1
Views: 492
Reputation: 97
I had the same issue, my problem was that for some reason I assumed that the node_modules folder was regenerated on their end and could be removed so it would not need to be sent separately. The node_modules folder IS required for @google-cloud/tasks to work. Make sure you have it if you run into this issue.
Upvotes: 0
Reputation: 317798
You probably ran npm install
in the wrong directory. Be sure to change to the directory where package.json exists before running that command.
Upvotes: 4