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.
You probably ran npm install
in the wrong directory. Be sure to change to the directory where package.json exists before running that command.