sindresorhus / pure

Pretty, minimal and fast ZSH prompt
MIT License
13.22k stars 978 forks source link

Installation on Raspberry Pi 4 running Ubuntu 20.04 LTS fails #610

Closed pommetjehorlepiep closed 3 years ago

pommetjehorlepiep commented 3 years ago

General information

System report (output of prompt_pure_system_report):

rpi4% prompt_pure_system_report
zsh: command not found: prompt_pure_system_report

Other information

I have:

Problem description

npm ERR! A complete log of this run can be found in:

- Does not work: `sudo npm install --global pure-prompt`

[sudo] password for ....:

pure-prompt@1.17.2 postinstall /usr/local/lib/node_modules/pure-prompt if [[ -e /opt/homebrew/bin/zsh ]]; then PURE_DEST=/opt/homebrew/share/zsh/site-functions npm run --silent postinstall-link && exit 0; elif [[ -e /usr/local/bin/zsh ]]; then PURE_DEST=/usr/local/share/zsh/site-functions npm run --silent postinstall-link && exit 0; elif [[ -e /bin/zsh ]] || [[ -e /usr/bin/zsh ]]; then PURE_DEST=/usr/share/zsh/site-functions npm run --silent postinstall-link && exit 0; fi; PURE_DEST="$PWD/functions" npm run --silent postinstall-link && npm run --silent postinstall-fail-instructions

sh: 1: [[: not found sh: 1: [[: not found sh: 1: [[: not found sh: 1: [[: not found glob error { [Error: EACCES: permission denied, scandir '/root/.npm/_logs'] errno: -13, code: 'EACCES', syscall: 'scandir', path: '/root/.npm/_logs' } npm ERR! code ELIFECYCLE npm ERR! errno 243 npm ERR! pure-prompt@1.17.2 postinstall: if [[ -e /opt/homebrew/bin/zsh ]]; then PURE_DEST=/opt/homebrew/share/zsh/site-functions npm run --silent postinstall-link && exit 0; elif [[ -e /usr/local/bin/zsh ]]; then PURE_DEST=/usr/local/share/zsh/site-functions npm run --silent postinstall-link && exit 0; elif [[ -e /bin/zsh ]] || [[ -e /usr/bin/zsh ]]; then PURE_DEST=/usr/share/zsh/site-functions npm run --silent postinstall-link && exit 0; fi; PURE_DEST="$PWD/functions" npm run --silent postinstall-link && npm run --silent postinstall-fail-instructions npm ERR! Exit status 243 npm ERR! npm ERR! Failed at the pure-prompt@1.17.2 postinstall script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

Because `/bin/sh` is symlinked by default to `/bin/dash`

- Does work: `sudo npm install --global --allow-root --unsafe-perm=true pure-prompt`
After changing symlinking `/bin/sh` to `/bin/bash`

sudo npm install --global pure-prompt --allow-root --unsafe-perm=true

pure-prompt@1.17.2 postinstall /usr/local/lib/node_modules/pure-prompt if [[ -e /opt/homebrew/bin/zsh ]]; then PURE_DEST=/opt/homebrew/share/zsh/site-functions npm run --silent postinstall-link && exit 0; elif [[ -e /usr/local/bin/zsh ]]; then PURE_DEST=/usr/local/share/zsh/site-functions npm run --silent postinstall-link && exit 0; elif [[ -e /bin/zsh ]] || [[ -e /usr/bin/zsh ]]; then PURE_DEST=/usr/share/zsh/site-functions npm run --silent postinstall-link && exit 0; fi; PURE_DEST="$PWD/functions" npm run --silent postinstall-link && npm run --silent postinstall-fail-instructions

Reproduction steps

See above

My .zshrc:

# Pure prompt
autoload -U promptinit; promptinit

zstyle :prompt:pure:host      color 250
zstyle :prompt:pure:path      color green
zstyle :prompt:pure:user:root color red

prompt pure
# Pure prompt
pommetjehorlepiep commented 3 years ago

Although installed, pure theme not recognized

rpi4% prompt -l
Currently available prompt themes:
adam1 adam2 bart bigfade clint default elite2 elite fade fire off oliver pws redhat restore suse walters zefram
mafredri commented 3 years ago

In the past installing pure via npm as root hasn't been supported, however, with a recent change (#606) this was supposed to become possible, but it turns out the location of site-functions is not as I expected on Debian/Ubuntu.

I'll create a PR for improving the folder detection in the installer later today, on your part this will probably require removing the /usr/share/zsh/site-functions folder if it has been created by npm install (e.g. check the date).

pommetjehorlepiep commented 3 years ago

In the past installing pure via npm as root hasn't been supported, however, with a recent change (#606) this was supposed to become possible, but it turns out the location of site-functions is not as I expected on Debian/Ubuntu.

I'll create a PR for improving the folder detection in the installer later today, on your part this will probably require removing the /usr/share/zsh/site-functions folder if it has been created by npm install (e.g. check the date).

Excellent! Thx.

mafredri commented 3 years ago

@pommetjehorlepiep didn't have time to create the PR before now, would you mind taking it for a spin (#611)? Checking out the repo/PR and running npm install (as root, I suppose) should sufficiently simulate what happens during a regular install.

pommetjehorlepiep commented 3 years ago

@pommetjehorlepiep didn't have time to create the PR before now, would you mind taking it for a spin (#611)? Checking out the repo/PR and running npm install (as root, I suppose) should sufficiently simulate what happens during a regular install.

Your change fixed the issue!

Output:

rpi4# npm install --allow-root --unsafe-perm=true 

> pure-prompt@1.17.2 postinstall /tmp/pure
> if [ -e /opt/homebrew/bin/zsh ]; then PURE_DEST=/opt/homebrew/share/zsh/site-functions npm run --silent postinstall-link && exit 0; elif [ -e /usr/local/bin/zsh ]; then PURE_DEST=/usr/local/share/zsh/site-functions npm run --silent postinstall-link && exit 0; elif [ -e /bin/zsh ] || [ -e /usr/bin/zsh ]; then for dest in /usr/share/zsh/site-functions /usr/local/share/zsh/site-functions; do if [ -d $dest ]; then PURE_DEST=$dest npm run --silent postinstall-link && exit 0; fi; done; fi; PURE_DEST="$PWD/functions" npm run --silent postinstall-link && npm run --silent postinstall-fail-instructions

up to date in 5.484s
found 0 vulnerabilities
❯ prompt -l
Currently available prompt themes:
pure adam1 adam2 bart bigfade clint default elite2 elite fade fire off oliver pws redhat restore suse walters zefram

Thanks for all your help and the quick fix @mafredri!