使用
启动我的firebase应用程序后firebase init
我尝试用
部署它firebase deploy
但我收到此错误
=== Deploying to 'fugis-auto-services-website'...
i deploying database, storage, functions, hosting
Error: An unexpected error has occurred.
所以我查看了firebase-debug.log,这就是它所说的
Tue May 01 2018 19:52:19 GMT-0500 (CDT)
[debug] [2018-05-02T00:52:19.967Z] <<< HTTP RESPONSE 200
[info]
[info] === Deploying to 'fugis-auto-services-website'...
[info]
[info] i deploying database, storage, functions, hosting
[debug] [2018-05-02T00:52:20.266Z] TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
at assertPath (path.js:39:11)
at Object.join (path.js:1157:7)
at Config.path (/Users/vanessaflores/.nvm/versions/node/v10.0.0/lib/node_modules/firebase-tools/lib/config.js:166:37)
at /Users/vanessaflores/.nvm/versions/node/v10.0.0/lib/node_modules/firebase-tools/lib/deploy/lifecycleHooks.js:68:38
at _chain (/Users/vanessaflores/.nvm/versions/node/v10.0.0/lib/node_modules/firebase-tools/lib/deploy/index.js:26:38)
at /Users/vanessaflores/.nvm/versions/node/v10.0.0/lib/node_modules/firebase-tools/lib/deploy/index.js:29:14
at process._tickCallback (internal/process/next_tick.js:178:7)
[error]
[error] Error: An unexpected error has occurred.
我不知道该怎么办。
答案 0 :(得分:2)
回答得太迟了,但将来可能会对某人有所帮助,我遇到了同样的问题,我添加了@Gleb提到的公用文件夹,并且在firebase.json内还需要指定公用文件夹,如下所示:< / p>
{
"hosting": {
"public": "public",
"rewrites": [
{
"source": "**",
"function": "helloWorld"
}
]
}
}
答案 1 :(得分:1)
这是我的firebase.json文件
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
},
"functions": {
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint"
],
"source": "functions"
}
}
答案 2 :(得分:1)
与我仅使用主机部分来设置标题一样,必须具有 public 属性!如果您未定义它,则会出现此问题
答案 3 :(得分:0)
我能够通过重新初始化firebase函数来解决这个问题:
firebase init functions
您可能需要先更新firebase-tools:
npm install -g firebase-tools
并备份现有的函数目录。
答案 4 :(得分:0)
我的问题最终是因为我将我的macOS更新为High Sierra 10.13.4并且以某种方式搞砸了我的nvm路径。我不得不更新nvm,我重新安装了Firebase,现在似乎工作正常。
答案 5 :(得分:0)
我遇到了同样的问题,因此在调试2小时后,我通过使用命令 $subscribers = explode(",", $user_to_follow );
$emails = array ();
foreach ( $subscribers as $subscriber ) {
$user_info = get_userdata($subscriber);
$emails[] = $user_info ->user_email;
}
$body = sprintf( $user_to_follow->display_name, 'followed your work! See <%s>' );
wp_mail( $emails, 'New followers!', $body );
将npm-conf降级为1.1.0来解决了该问题。
答案 6 :(得分:0)
我在不传递实际文档路径的情况下使用了 onCreate 或 onUpdate 之类的 Firestore 回调。
functions.firestore
.document()
.onCreate()
把它变成
functions.firestore
.document('collection/doc')
.onCreate()