sindresorhus / pure

Pretty, minimal and fast ZSH prompt
MIT License
13.12k stars 971 forks source link

Symlinking prompt fails when installed via npm #573

Closed bjesuiter closed 3 years ago

bjesuiter commented 3 years ago

General information

System report (output of prompt_pure_system_report):

can't load the tool, since it is not on my path currently

Other information

If you can't load Pure to create a system report, please report the following information:

I have:

Problem description

When Installing pure promt, I'll get the following error:

bjesuiter@DESKTOP-VCE34A2 ~ % npm install --global pure-prompt

> pure-prompt@1.14.0 postinstall /Users/bjesuiter/.nvm/versions/node/v14.15.0/lib/node_modules/pure-prompt
> PURE_DEST=/usr/local/share/zsh/site-functions npm run --silent postinstall-link && exit 0; PURE_DEST="$PWD/functions" npm run postinstall-link && npm run postinstall-fail-instructions

mkdir: /usr/local/share/zsh/site-functions: Permission denied

> pure-prompt@1.14.0 postinstall-link /Users/bjesuiter/.nvm/versions/node/v14.15.0/lib/node_modules/pure-prompt
> mkdir -p "$PURE_DEST" && ln -sf "$PWD/pure.zsh" "$PURE_DEST/prompt_pure_setup" && ln -sf "$PWD/async.zsh" "$PURE_DEST/async"

> pure-prompt@1.14.0 postinstall-fail-instructions /Users/bjesuiter/.nvm/versions/node/v14.15.0/lib/node_modules/pure-prompt
> echo "ERROR: Could not automagically symlink the prompt. Either:\n1. Check out the readme on how to do it manually: https://github.com/sindresorhus/pure#manually\n2. Or add the following to your \`.zshrc\`:\n\n    fpath+=('$PWD/functions')"

ERROR: Could not automagically symlink the prompt. Either:
1. Check out the readme on how to do it manually: https://github.com/sindresorhus/pure#manually
2. Or add the following to your `.zshrc`:

    fpath+=('/Users/bjesuiter/.nvm/versions/node/v14.15.0/lib/node_modules/pure-prompt/functions')
+ pure-prompt@1.14.0
added 1 package from 1 contributor in 1.169s

Reproduction step

  1. simply install globally on the given environment: npm install --global pure-prompt

My .zshrc:

Probably not relevant to the problem, maybe more of a MacOS Write Permission issue / issue with permission to create symlinks?

mafredri commented 3 years ago

I think the fallback only works when using zsh from Homebrew. Not sure if there's really anything we can do to fix the issue since we don't want to start modifying filesystem permissions.

The error message outlines two possible fixes for your issue:

1. Check out the readme on how to do it manually: https://github.com/sindresorhus/pure#manually
2. Or add the following to your `.zshrc`:

    fpath+=('/Users/bjesuiter/.nvm/versions/node/v14.15.0/lib/node_modules/pure-prompt/functions')
bjesuiter commented 3 years ago

Thanks, I now settled with the fpath variant, even though this is dependent on the currently active node version.

Maybe it should be added to the readme, that the native macOS zsh may not work, regarding to symlinking / that this package is assumed to be used with the brew variant of zsh?

mafredri commented 3 years ago

Thanks, I now settled with the fpath variant, even though this is dependent on the currently active node version.

Isn't that only because you're using nvm, though? Normally it'd be placed under /usr/local/lib/node_modules in which case there's no tie-in with version. Unfortunately we can't support every possible software setup as people have their own preferences, that's why we have the manual instructions.