typewritten icon indicating copy to clipboard operation
typewritten copied to clipboard

npm install does not write to .zshrc on Linux

Open bound-variable opened this issue 3 years ago • 6 comments

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.

bound-variable avatar Feb 18 '22 20:02 bound-variable

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

reobin avatar Feb 19 '22 16:02 reobin

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

bound-variable avatar Feb 20 '22 01:02 bound-variable

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 avatar Feb 25 '22 01:02 reobin

@reobin

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

allcontributors[bot] avatar Feb 25 '22 01:02 allcontributors[bot]

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

ganler avatar Oct 07 '22 19:10 ganler

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

suckerSlayer avatar Jun 04 '23 20:06 suckerSlayer