firebase / firebase-tools

The Firebase Command Line Tools
MIT License
4.02k stars 936 forks source link

Firebase CLI : Error: An unexpected error has occurred. #227

Closed jbpresident closed 5 years ago

jbpresident commented 8 years ago

Tried 3 times. Always the same. Installed the firebase tools new with npm. Again the same error. Any help ? And where can i find the firebase-debug.log ?

----TRIED FIREBASE INIT ------------------------- ..... ..... === Database Setup Firebase Realtime Database Rules allow you to define how your data should be structured and when your data can be read from and written to.

? What file should be used for Database Rules? database.rules.json

Error: An unexpected error has occurred.

Having trouble? Try again or contact support with contents of firebase-debug.log

mbleigh commented 7 years ago

Try running the command with --debug

clust3rsekt0r commented 7 years ago

Hi huys I'm getting this error when I try to firebase init

? What do you want to use as your public directory? c:\angprojects\tut\dist\ ? Configure as a single-page app (rewrite all urls to /index.html)? Yes Error: EEXIST: file already exists, mkdir 'C:\angprojects\tut' at Object.fs.mkdirSync (fs.js:855:18) at mkdirsSync (C:\Users\clust\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\fs-extra\lib\mkdirs\mkdirs-sync.js:22:9) at mkdirsSync (C:\Users\clust\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\fs-extra\lib\mkdirs\mkdirs-sync.js:27:16) at mkdirsSync (C:\Users\clust\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\fs-extra\lib\mkdirs\mkdirs-sync.js:28:9) at mkdirsSync (C:\Users\clust\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\fs-extra\lib\mkdirs\mkdirs-sync.js:28:9) at mkdirsSync (C:\Users\clust\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\fs-extra\lib\mkdirs\mkdirs-sync.js:28:9) at mkdirsSync (C:\Users\clust\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\fs-extra\lib\mkdirs\mkdirs-sync.js:28:9) at mkdirsSync (C:\Users\clust\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\fs-extra\lib\mkdirs\mkdirs-sync.js:28:9) at mkdirsSync (C:\Users\clust\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\fs-extra\lib\mkdirs\mkdirs-sync.js:28:9) at mkdirsSync (C:\Users\clust\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\fs-extra\lib\mkdirs\mkdirs-sync.js:28:9)

Error: An unexpected error has occurred.

mInzamamMalik commented 7 years ago

please help

I'm getting this error when try to install firebase-tools:

PS D:\Projects\Uni\firebase-functions-hello-world> npm install -g firebase-tools
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\
\npm-cli.js" "install" "-g" "firebase-tools"
npm ERR! node v6.10.0
npm ERR! npm  v3.10.10

npm ERR! shasum check failed for C:\Users\AdMin\AppData\Local\Temp\npm-8448-fdc26aac\registry.npmjs.org
\jju\-\jju-1.3.0.tgz
npm ERR! Expected: dadd9ef01924bc728b03f2f7979bdbd62f7a2aaa
npm ERR! Actual:   2a552ad636b1e23979c677ab9f360cf1ac578f89
npm ERR! From:     https://registry.npmjs.org/jju/-/jju-1.3.0.tgz
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     D:\Projects\Uni\firebase-functions-hello-world\npm-debug.log
PS D:\Projects\Uni\firebase-functions-hello-world>
sunnypatel commented 7 years ago

I ended up removing the function and retrying....seemed to solve whatever there issue was.

viralpatel380 commented 7 years ago

C:\Users\Viral\Desktop\Chat App\web-start>firebase deploy --debug [2017-08-13T16:32:34.360Z] ---------------------------------------------------------------------- [2017-08-13T16:32:34.375Z] Command: C:\Program Files\nodejs\node.exe C:\Users\Viral\AppData\Roaming\npm\node_modules\firebase-tools\bin\firebase deploy --debug [2017-08-13T16:32:34.375Z] CLI Version: 3.9.2 [2017-08-13T16:32:34.375Z] Platform: win32 [2017-08-13T16:32:34.375Z] Node Version: v6.11.1 [2017-08-13T16:32:34.375Z] Time: Sun Aug 13 2017 22:02:34 GMT+0530 (India Standard Time) [2017-08-13T16:32:34.375Z] ----------------------------------------------------------------------

[2017-08-13T16:32:34.391Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"] [2017-08-13T16:32:34.391Z] > authorizing via signed-in user [2017-08-13T16:32:34.391Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/fir-bad72 Sun Aug 13 2017 22:02:34 GMT+0530 (India Standard Time) [2017-08-13T16:32:36.790Z] <<< HTTP RESPONSE 200 server=nginx, date=Sun, 13 Aug 2017 16:32:35 GMT, content-type=application/json; charset=utf-8, content-length=98, connection=close, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains, cache-control=no-cache, no-store [2017-08-13T16:32:36.790Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/database/fir-bad72/tokens Sun Aug 13 2017 22:02:36 GMT+0530 (India Standard Time) [2017-08-13T16:32:38.411Z] <<< HTTP RESPONSE 200 server=nginx, date=Sun, 13 Aug 2017 16:32:37 GMT, content-type=application/json; charset=utf-8, content-length=421, connection=close, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains, cache-control=no-cache, no-store

=== Deploying to 'fir-bad72'...

i deploying functions, hosting [2017-08-13T16:32:41.614Z] > [functions] package.json contents: { "name": "friendlychat-codelab", "description": "Firebase SDK for Cloud Functions codelab", "dependencies": { "firebase-admin": "^4.1.1", "firebase-functions": "^0.5.1" } } i functions: ensuring necessary APIs are enabled... i runtimeconfig: ensuring necessary APIs are enabled... [2017-08-13T16:32:41.614Z] >>> HTTP REQUEST GET https://servicemanagement.googleapis.com/v1/services/cloudfunctions.googleapis.com/projectSettings/fir-bad72?view=CONSUMER_VIEW Sun Aug 13 2017 22:02:41 GMT+0530 (India Standard Time) [2017-08-13T16:32:41.614Z] >>> HTTP REQUEST GET https://servicemanagement.googleapis.com/v1/services/runtimeconfig.googleapis.com/projectSettings/fir-bad72?view=CONSUMER_VIEW Sun Aug 13 2017 22:02:41 GMT+0530 (India Standard Time) [2017-08-13T16:32:43.935Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Sun, 13 Aug 2017 16:32:42 GMT, server=ESF, cache-control=private, x-xss-protection=1; mode=block, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="39,38,37,35", accept-ranges=none, connection=close

Error: An unexpected error has occurred.

michaelmenlikalew commented 7 years ago

Use one of this 3 options. They are the best solutions copy and past the link below https://docs.npmjs.com/getting-started/fixing-npm-permissions

FiringBlanks commented 7 years ago

After wrestling with this issue for half a day, I found a solution that works for me.

It looks like firebase init has issues with the different shells. The Git MINGW64 shell is my main shell for Angular development. firebase inithad an issue with that one where the up/down arrow keys wouldn't work when selecting the service (database or hosting), so I use the Windows cmd for running firebase init. When I continue on in the Windows cmd for deploying, it hangs, and eventually gives me this message ("Error: An unexpected error has occurred"). Running the firebase deploy command from the MINGW64 shell, however, fixes this issue. In summary, I use: -ng build --prod (from MINGW. May also work from cmd) -firebase init (from cmd) -firebase deploy (from MINGW)

This is weird since it was all working in the Windows cmd line just yesterday. I didn't make any changes since then.

jamsheedpk commented 6 years ago

viralpatel380 commented on 13 Aug 2017 any idea plz help same bug

cbracamonte commented 6 years ago

Solution: npm uninstall firebase npm uninstall firebase-tools

After: npm install -g firebase-tools@latest

In firebase.json: { "hosting": { "public": "dist", "ignore": [ "firebase.json", "database-rules.json", "storage.rules", "functions", "*/.", "/node_modules/" ], "headers": [ { "source": "*/.@(js|html)", "headers": [ { "key": "Cache-Control", "value": "max-age=0" } ] } ] } }

russellsean commented 5 years ago
lisct commented 5 years ago

yarn add firebase-tools@latest works for me.

bkendall commented 5 years ago

Closing this issue as the original question seemed to be answered. If you are having issues still, please open a new issue with and include the contents of firebase-debug.log or the output with the --debug flag.

vaibhavgehani commented 5 years ago

Closing this issue as the original question seemed to be answered. If you are having issues still, please open a new issue with and include the contents of firebase-debug.log or the output with the --debug flag.

[debug] [2019-06-22T06:28:48.075Z] ---------------------------------------------------------------------- [debug] [2019-06-22T06:28:48.079Z] Command: C:\Program Files (x86)\nodejs\node.exe C:\Users\intel\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js login [debug] [2019-06-22T06:28:48.079Z] CLI Version: 7.0.1 [debug] [2019-06-22T06:28:48.079Z] Platform: win32 [debug] [2019-06-22T06:28:48.079Z] Node Version: v10.15.3 [debug] [2019-06-22T06:28:48.081Z] Time: Sat Jun 22 2019 11:58:48 GMT+0530 (India Standard Time) [debug] [2019-06-22T06:28:48.081Z] ---------------------------------------------------------------------- [debug] [info] [info] Visit this URL on any device to log in: [info] https://accounts.google.com/o/oauth2/auth?client_id=563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com&scope=email%20openid%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloudplatformprojects.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Ffirebase%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform&response_type=code&state=468103980&redirect_uri=http%3A%2F%2Flocalhost%3A9005 [info] [info] Waiting for authentication... [debug] [2019-06-22T06:28:50.860Z] Error: spawn cmd ENOENT at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19) at onErrorNT (internal/child_process.js:415:16) at process._tickCallback (internal/process/next_tick.js:63:19) [error] [error] Error: An unexpected error has occurred.

bkendall commented 5 years ago

@vaibhavgehani please open a new issue with all the appropriate information. Thanks.

snaulX commented 5 years ago
Waiting for authentication...
[2019-07-23T09:16:17.875Z] Error: spawn cmd ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)

Error: An unexpected error has occurred.
snaulX commented 5 years ago

its with --debug flag

bkendall commented 5 years ago

@snaulX please open a new issue rather than commenting on this old issue. Thanks.