firebase deploy gives a “path” error

与世无争的帅哥 提交于 2020-08-06 07:50:47

问题


After initiating my firebase app with

firebase init

I tried to deploy it with

firebase deploy

but I get this error

    === Deploying to 'fugis-auto-services-website'...

i  deploying database, storage, functions, hosting

Error: An unexpected error has occurred.

So I looked at the firebase-debug.log and this is what it says

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.

I'm not sure how to proceed.


回答1:


Too late to answer but might help someone in future, I had the same issue, i added the public folder as mentioned by @Gleb and inside your firebase.json you need to specify the public folder as well, like so:

{
"hosting": {
"public": "public",
"rewrites": [
  {
    "source": "**",
    "function": "helloWorld"
  }
]
}
}



回答2:


Had same issue as i use hosting part just to setup headers, public property is necessary! If you not define it you would have this issue




回答3:


I was able to fix this by re-initializing firebase functions:

firebase init functions

You might want to first update your firebase-tools:

npm install -g firebase-tools

and backup your existing functions directory.




回答4:


My problem ended up being that I updated my macOS to High Sierra 10.13.4 and that somehow screwed up my paths for nvm. I had to update nvm and I reinstalled Firebase and now things seem to be working.




回答5:


I was facing the same problem so after debugging for 2 hours I solved the problem by downgrading npm-conf to 1.1.0 with the command npm install npm-conf@1.1.0



来源:https://stackoverflow.com/questions/50125826/firebase-deploy-gives-a-path-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!