firebase / firebase-tools

The Firebase Command Line Tools
MIT License
3.98k stars 918 forks source link

"SyntaxError: Unexpected end of JSON input" appears on startup of firebase-tools-instant-win.exe #3432

Open crowne opened 3 years ago

crowne commented 3 years ago

[REQUIRED] Environment info

firebase-tools: 9.12.0

Platform: OS Name - Microsoft Windows 10 Pro Version - 10.0.19042 Build 19042

[REQUIRED] Test case

Download firebase-tools-instant-win.exe from https://firebase.tools/bin/win/instant/latest The run the .exe

[REQUIRED] Steps to reproduce

[REQUIRED] Expected behavior

Normal startup

[REQUIRED] Actual behavior

########################################################################################################################

     Welcome to...
   ######## #### ########  ######## ########     ###     ######  ########  ##
   ##        ##  ##     ## ##       ##     ##  ##   ##  ##       ##        ##
   ######    ##  ########  ######   ########  #########  ######  ######    ##
   ##        ##  ##    ##  ##       ##     ## ##     ##       ## ##
   ##       #### ##     ## ######## ########  ##     ##  ######  ########  ##

########################################################################################################################

~ Let's make sure your Firebase CLI is ready...
undefined:1

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at ChildProcess.<anonymous> (C:\snapshot\firepit\welcome.js:115:27)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1021:16)
    at Socket.<anonymous> (internal/child_process.js:443:11)
    at Socket.emit (events.js:315:20)
    at Pipe.<anonymous> (net.js:674:12)

> firebase --version
9.12.0

>
google-oss-bot commented 3 years ago

This issue does not have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information.

mightyfrog commented 2 years ago

This happens if you put firebase-tools-instant-win.exe in other than C: drive.

lokenjon commented 2 years ago

How many hundred of thousands of developers will download TO THE D DRIVE (not C) and run firebase-tools-instant-win.exe only for the installation to fail without a meaning full error message. At least put in a warning statement that the exe file should be placed on the C drive before running. Took me hours of hair-pulling to register a flutter project.

swavkulinski commented 2 years ago

This issue resurfaced in 11.2.2 but then gone in 11.3.0. It was happening when installed on drive C:

jeremyhalin commented 1 year ago

Happening to me even if installed on C drive.

jasonw4331 commented 1 year ago

Issue persists in 11.16.0 consistently when exe placed outside C:/ drive.

#####################################################################################################################################
     Welcome to...
   ######## #### ########  ######## ########     ###     ######  ########  ##
   ##        ##  ##     ## ##       ##     ##  ##   ##  ##       ##        ##
   ######    ##  ########  ######   ########  #########  ######  ######    ##
   ##        ##  ##    ##  ##       ##     ## ##     ##       ## ##
   ##       #### ##     ## ######## ########  ##     ##  ######  ########  ##

#####################################################################################################################################
~ Let's make sure your Firebase CLI is ready...
undefined:1

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at ChildProcess.<anonymous> (C:\snapshot\firepit\welcome.js:115:27)
    at ChildProcess.emit (node:events:527:28)
    at maybeClose (node:internal/child_process:1092:16)
    at Socket.<anonymous> (node:internal/child_process:451:11)
    at Socket.emit (node:events:527:28)
    at Pipe.<anonymous> (node:net:709:12)

> firebase --version
11.16.0
mediocre9 commented 1 year ago

Issue persists in 11.16.0 consistently when exe placed outside C:/ drive.

#####################################################################################################################################
     Welcome to...
   ######## #### ########  ######## ########     ###     ######  ########  ##
   ##        ##  ##     ## ##       ##     ##  ##   ##  ##       ##        ##
   ######    ##  ########  ######   ########  #########  ######  ######    ##
   ##        ##  ##    ##  ##       ##     ## ##     ##       ## ##
   ##       #### ##     ## ######## ########  ##     ##  ######  ########  ##

#####################################################################################################################################
~ Let's make sure your Firebase CLI is ready...
undefined:1

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at ChildProcess.<anonymous> (C:\snapshot\firepit\welcome.js:115:27)
    at ChildProcess.emit (node:events:527:28)
    at maybeClose (node:internal/child_process:1092:16)
    at Socket.<anonymous> (node:internal/child_process:451:11)
    at Socket.emit (node:events:527:28)
    at Pipe.<anonymous> (node:net:709:12)

> firebase --version
11.16.0

renaming firebase-tools-instant-win.exe file to firebase-win.exe worked for me.

jacisback commented 1 year ago

I'm also getting this issue. The .exe is installed on the C drive and I renamed it to firebase-win.exe but still no success. I also tried to delete the firebase folder created in C:\Users\{MYPROFILENAME}\.cache and run again but no effect. Any other solutions found to this error? I'm using flutter and not node.js so trying to avoid the npm route...


########################################################################################################################

     Welcome to...
   ######## #### ########  ######## ########     ###     ######  ########  ##
   ##        ##  ##     ## ##       ##     ##  ##   ##  ##       ##        ##
   ######    ##  ########  ######   ########  #########  ######  ######    ##
   ##        ##  ##    ##  ##       ##     ## ##     ##       ## ##
   ##       #### ##     ## ######## ########  ##     ##  ######  ########  ##

########################################################################################################################

~ Let's make sure your Firebase CLI is ready...
undefined:1

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at ChildProcess.<anonymous> (C:\snapshot\firepit\welcome.js:115:27)
    at ChildProcess.emit (node:events:527:28)
    at maybeClose (node:internal/child_process:1092:16)
    at Socket.<anonymous> (node:internal/child_process:451:11)
    at Socket.emit (node:events:527:28)
    at Pipe.<anonymous> (node:net:709:12)

> firebase --version
11.24.1
mediocre9 commented 1 year ago

hello @jacisback, the renaming solution did work for me, but after the update I got the same error. I know that you want to avoid the nodejs approach, but installing it through npm was the real fix for me.

KaioSantos32 commented 1 year ago

Guys, I simply put the EXE literally in the C folder and worked. Try that.

jea-ms commented 1 year ago

I also have the same issue. I already did

But still can't use firebase. So I installed it using npm: npm install -g firebase-tools -f After that there is still an error:

Firebase CLI v11.25.1 is incompatible with Node.js v14.17.3 Please upgrade Node.js to version ^14.18.0 || >=16.4.0

I tried to upgrade

npm cache clean -f npm install -g n

but I can't install as x64 is not supported.

npm ERR! code EBADPLATFORM npm ERR! notsup Unsupported platform for n@9.0.1: wanted {"os":"!win32","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm ERR! notsup Valid OS: !win32 npm ERR! notsup Valid Arch: any npm ERR! notsup Actual OS: win32 npm ERR! notsup Actual Arch: x64

So I just downloaded the installer from their site: download link Installed it on my C drive. Now i can run this from powershell: firebase login

i Firebase optionally collects CLI and Emulator Suite usage and error reporting information to help improve our products. > Data is collected in accordance with Google's privacy policy (https://policies.google.com/privacy) and is not used to identify you. ? Allow Firebase to collect CLI and Emulator Suite usage and error reporting information? Yes i To change your data collection preference at any time, run firebase logout and log in again. Visit this URL on this device to log in:

It is working for me now.

firebase -V: 11.25.1 node -v: v18.15.0

pavelsg commented 1 year ago

lol, the damn thing just seems to remember it's executable name was on the first start (i.e. firebase-win-instant.exe), so after I have renamed it to firebase.exe (expected by dart) and moved to other folder it fails on startup with this weird JSON error. So after renaming it back to what it was on the first start (firebase-win-instant.exe) it is able to start w/o failure. I have left it in the other folder, so path doesn't seems to matter (haven't tried it outside of C: drive though).

sidprice commented 1 year ago

With the firebase_win_instant.exe name, how does dart know about that name? When I execute "flutterfire configure" it fails to find "firebase.exe," of course!

pavelsg commented 1 year ago

@sidprice I've ended up installing it using Node.js path

sidprice commented 1 year ago

@pavelsg Thanks, I was trying to avoid having to install another package I would rarely use :(

Seems there may be no choice.

RandallFlagg commented 11 months ago

I renamed the file to _firebase_win_instant.exe_ in drive C in any folder and it seems to work(Just login. Didn't try something else yet.) . This is super annoying. Is there a chance this will be fixed soon?

Firebase version: 12.4.8

tmilker commented 10 months ago

@pavelsg Thanks, I was trying to avoid having to install another package I would rarely use :(

Seems there may be no choice.

I fixed this by adding:

Set-Alias -Name firebase -Value firebase-tools-instant-win.exe

to my Powershell profile with firebase-tools-instant-win.exe in my path. This lets me run flutterfire within the Firebase CLI. Joke's on me though because flutterfire doesn't support the windows platform so I can't use it anyway!

Mercutio1243 commented 5 months ago

I faced this error multiple times today. The file was on c:\, but it seems antivirus software Avast was messing with it (quarantine, renaming file to include ~-character). When deactivating antivirus and downloading anew, the issue disappeared.