【发布时间】:2017-08-28 00:43:49
【问题描述】:
我一直在做一个 Firebase 函数项目,在本地运行服务进行测试。
一切正常,但后来我将源文件夹移动到新位置(进入源代码管理),现在它无法运行,因为某处某处记住了项目的旧位置强>。
那么 Firebase 到底在哪里“记住”项目/源的原始位置?
我该如何解决?
更多信息:
平台:Windows 7
节点:v6.11.1(建议:https://cloud.google.com/functions/docs/writing)
下面是我运行“firebase serve --only functions”并点击服务 URL 时的输出。
忽略带有“无法模拟...”和“无 HTTPS...”的行 - 这是正常的。 下一个 "error:" 行,其余部分在 URL 被命中时发出。
重点是:
a) 我的项目所在的文件夹显示在第一行(以标准 Windows CMD 提示方式)
b) “找不到模块”错误正在寻找完全不同的 文件夹。事实上,它正在寻找项目使用的位置。
D:\_DEV\svn\FredSays\onGoogleAssistant\functions>firebase serve --only functions
=== Serving from 'D:\_DEV\svn\FredSays\onGoogleAssistant'...
i functions: Preparing to emulate HTTPS functions. Support for other event types coming soon.
! functions: Failed to emulate FredSays
i functions: No HTTPS functions emulated. Support for other function types are coming soon.
error: module.js:471
throw err;
^
Error: Cannot find module 'D:\_DEV\FredSays\actionssdk-say-number-nodejs-master\functions'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at process.on.e (D:\_TOOLS\nvm\v6.11.1\node_modules\firebase-tools\node_modules\@google-cloud\functions-emulator\src\supervisor\worker.js:64:28)
at emitTwo (events.js:106:13)
at process.emit (events.js:191:7)
at process.nextTick (internal/child_process.js:758:12)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)
error: Function worker crashed with exit code: 1
我在列出旧位置的项目树中找不到任何内容。 我已经尝试了以下所有方法:
npm cache clean
firebase init functions
firebase logout & firebase login
DEL /S /Q node_modules & npm install
npm uninstall -g firebase-tools & npm install -g firebase-tools
以上都无济于事。
请帮忙。我的项目现在已经泡汤了。
【问题讨论】:
-
你用的nodejs版本是什么?
-
添加了 Nodejs 版本。 = v6.11.1,由 Google Cloud Functions doco 建议。
-
因为错误无法模仿你试试Run Functions Locally
-
@aofdev - 我不清楚你在说什么。如上所示,根据您提供的链接,我在本地运行。你能澄清一下你的建议吗?
标签: firebase google-cloud-functions firebase-tools