rajasegar / alacritty-themes

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

alacritty-themes TypeError #23

Closed matthewdeancooper closed 3 years ago

matthewdeancooper commented 3 years ago

Fresh install using

npm i -g alacritty-themes

Getting the following error after running

alacritty-themes
/usr/local/lib/node_modules/alacritty-themes/index.js:40
  ].flat();
    ^

TypeError: [(intermediate value)(intermediate value)(intermediate value),[path.resolve(...),path.resolve(...)]].flat is not a function
    at getAlacrittyConfig (/usr/local/lib/node_modules/alacritty-themes/index.js:40:5)
    at Object.<anonymous> (/usr/local/lib/node_modules/alacritty-themes/index.js:46:17)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/alacritty-themes/bin/cli.js:8:51)
PranavBhattarai commented 3 years ago

I have similar issue in Fedora 34:

pranav@fedora ~> npx alacritty-themes
npx: installed 20 in 4.106s
? Select a theme ›
❯   3024.dark
    3024.light
    Afterglow
    Argonaut
    Ashes.dark
    Ashes.light
    Astromouse
    Atelierdune.dark
    Atelierdune.light
  ↓ Atelierforest.dark/home/pranav/.npm/_npx/16203/lib/node_modules/alacritty-themes/index.js:75
  const colors = doc.contents.items.filter((i) => i.key.value === 'colors')[0];
                              ^
TypeError: Cannot read property 'items' of null
    at updateTheme (/home/pranav/.npm/_npx/16203/lib/node_modules/alacritty-themes/index.js:75:31)
    at /home/pranav/.npm/_npx/16203/lib/node_modules/alacritty-themes/index.js:104:5
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:73:3)
rajasegar commented 3 years ago

Is your config file in proper shape or place, can you try creating one before choosing the themes:

alacritty-themes --create
PranavBhattarai commented 3 years ago

@rajasegar Wow, thanks a lot. But my command was a little bit tricky:

npx alacritty-themes --create
npx alacritty-themes

Thanks. A LOT of themes to select. Can be overwhelming.

matthewdeancooper commented 3 years ago

My config file empty and is located at

$HOME/.config/alacritty/alacritty.yml

After running the command, I get the same error

alacritty-themes --create
alacritty alacritty-themes --create
/usr/local/lib/node_modules/alacritty-themes/index.js:40
  ].flat();
    ^

TypeError: [(intermediate value)(intermediate value)(intermediate value),[path.resolve(...),path.resolve(...)]].flat is not a function
    at getAlacrittyConfig (/usr/local/lib/node_modules/alacritty-themes/index.js:40:5)
    at Object.<anonymous> (/usr/local/lib/node_modules/alacritty-themes/index.js:46:17)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/alacritty-themes/bin/cli.js:8:51)
rajasegar commented 3 years ago

@matthewdeancooper Let me try to re-create the scenario with my machine and see if I can reproduce the error. BTW, I need some info like what machine, OS, and Node version you are using, though would be helpful to identify the issue on a deeper level.

rajasegar commented 3 years ago

Fixed in 3.2.4

matthewdeancooper commented 3 years ago

Cheers!