rajasegar / alacritty-themes

:rainbow: :lollipop: Themes :candy: :heart_eyes: for Alacritty: A cross-platform GPU-accelerated Terminal emulator
MIT License
703 stars 70 forks source link

Document with errors cannot be stringified #20

Closed 3nt3 closed 3 years ago

3nt3 commented 3 years ago

When starting with npx alacritty-themes, this happens:

Error: Document with errors cannot be stringified
    at Document.toString (/home/ente/.npm/_npx/808b709e6234a442/node_modules/yaml/dist/Document-9b4560a1.js:676:39)
    at String (<anonymous>)
    at updateTheme (/home/ente/.npm/_npx/808b709e6234a442/node_modules/alacritty-themes/index.js:91:22)
    at /home/ente/.npm/_npx/808b709e6234a442/node_modules/alacritty-themes/index.js:104:5
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3)

The full output looks like this:

? Select a theme ›
❯   3024.dark
    3024.light
    Afterglow
    Argonaut
    Ashes.dark
    Ashes.light
    Astromouse
    Atelierdune.dark
    Atelierdune.light
  ↓ Atelierforest.dark/home/ente/.npm/_npx/808b709e6234a442/node_modules/yaml/dist/Document-9b4560a1.js:676
    if (this.errors.length > 0) throw new Error('Document with errors cannot be stringified');
                                ^

Error: Document with errors cannot be stringified
    at Document.toString (/home/ente/.npm/_npx/808b709e6234a442/node_modules/yaml/dist/Document-9b4560a1.js:676:39)
    at String (<anonymous>)
    at updateTheme (/home/ente/.npm/_npx/808b709e6234a442/node_modules/alacritty-themes/index.js:91:22)
    at /home/ente/.npm/_npx/808b709e6234a442/node_modules/alacritty-themes/index.js:104:5
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3)

The program works as expected when run as just alacritty-themes (without npx)

3nt3 commented 3 years ago

Okay, nevermind it also doesn't work without npx - just doesn't crash immediately

3nt3 commented 3 years ago

Update, after deleting the config and generating a "fresh" one the program works.

EralpCelebi commented 2 years ago

Well, how do we do it without generating a fresh one? :D

I encountered the same problem after holding down the down arrow key, which supposedly stopped the write operation to my config file when it wasn't supposed to be stopped. My configuration works perfectly fine but the tool still complains.

EralpCelebi commented 2 years ago

if anyone is confused about this, the tool generates some junk at the end of your configuration file (alacritty.yml found in $HOME/.config/alacritty/alacritty.yml).

Remove whatever was written (which is most likely to be about themes) from the last few lines and the errors should go away.