reobin / typewritten

A minimal, lightweight, informative zsh prompt theme

Home Page:https://typewritten.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

npm install does not write to .zshrc on Linux

bound-variable opened this issue · comments

commented

Describe the bug
Following the npm installation, no changes are made to .zshrc.

To Reproduce

  1. Run npm install -g typewritten
  2. Check .zshrc

Expected behavior
Changes to .zshrc

Desktop (please complete the following information):

  • OS: Arch
  • Browser [qutebrowser]
  • Version [1.4.6]

Additional context
My zsh folder abides by XDG specs, and is specified by the environment variable ZDOTDIR, pointing to ~/.config/zsh.

Manual installation works.

Hi @Pound-Hash ! Thank you for bringing up this issue.

Do you have any error message during the npm installation?

Here are the lines of code trying to insert to your .zshrc:

append_zshrc() {
  info "These lines will be added to your \"${ZDOTDIR:-$HOME}/.zshrc\" file:"
  code "$@"
  echo "$@" >> "${ZDOTDIR:-$HOME}/.zshrc"
}

...
msg = ...
...

if append_zshrc "$msg"; then
  success "Done! Please, reload your terminal."
  echo
else
  error "Cannot automatically insert prompt init commands."
  error "Please insert these line into your \"${ZDOTDIR:-$HOME}/.zshrc\" file:"
  code "$msg"
  exit 1
fi

It should either print "Done!" or the error message

commented

Hi @Pound-Hash ! Thank you for bringing up this issue.

Do you have any error message during the npm installation?

I don't.

Here's the output:

❯ sudo npm install -g typewritten

added 1 package, and audited 2 packages in 638ms

found 0 vulnerabilities
❯ echo $?
0

Thank you @Pound-Hash for the details! I'll have a look whenever I have time to reproduce it.

@all-contributors please add @Pound-Hash for bugs

@reobin

I've put up a pull request to add @Pound-Hash! 🎉

Same issue here. The installation does not work for Ubuntu 22.04.

Same issue. ButI found the npm installation way works when I login as a root. While it doesn't work when I install it as a normal user, and if I try prompt -l, the result doesn't include typewritten