Firebase CLI控制台:找不到模块@google-cloud/tasks

huangapple go评论60阅读模式
英文:

Firebase CLI console: Cannot find module @google-cloud/tasks

问题

我在我的 index.js 文件中依赖了 Cloud Tasks:const {CloudTasksClient} = require("@google-cloud/tasks")。但是当我尝试部署我的云函数使用 Tasks 时,它完成时出现了错误:详细的堆栈跟踪:错误:找不到模块 '@google-cloud/tasks'。然后我再次运行了 npm install @google-cloud/tasks,控制台没有显示错误,看起来成功了。当我检查我的 package.jsonpackage-lock.json 文件时,它们没有包含任何关于 @google-cloud/tasks 的内容。有什么想法吗?谢谢。

英文:

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.

答案1

得分: 2

你可能在错误的目录中运行了 npm install。在运行该命令之前,请确保切换到包含 package.json 文件的目录中。

英文:

You probably ran npm install in the wrong directory. Be sure to change to the directory where package.json exists before running that command.

huangapple
  • 本文由 发表于 2023年6月13日 01:53:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/76459162.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定