Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nvm-exec script #211

Closed
rob4226 opened this issue Jun 5, 2023 · 3 comments
Closed

nvm-exec script #211

rob4226 opened this issue Jun 5, 2023 · 3 comments

Comments

@rob4226
Copy link

rob4226 commented Jun 5, 2023

Hi, thank you for this great fish plugin!

nvm has an nvm-exec script which is useful when you're not in an interactive shell for things like systemd services like:

Environment=NODE_VERSION=16
ExecStart=/var/www/cryptpad/.nvm/nvm-exec node /var/www/cryptpad/server.js

Here's how nvm does it:
https://github.com/nvm-sh/nvm/blob/master/nvm-exec

#!/usr/bin/env bash

DIR="$(command cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

unset NVM_CD_FLAGS

# shellcheck disable=SC1090,SC1091
\. "$DIR/nvm.sh" --no-use

if [ -n "$NODE_VERSION" ]; then
  nvm use "$NODE_VERSION" > /dev/null || exit 127
elif ! nvm use >/dev/null 2>&1; then
  echo "No NODE_VERSION provided; no .nvmrc file found" >&2
  exit 127
fi

exec "$@"

Does nvm.fish have something like this? Thank you.

@jorgebucaran
Copy link
Owner

Duplicated #207

@rob4226
Copy link
Author

rob4226 commented Jun 5, 2023

I believe the nvm exec command and the ./nvm-exec script are different things.

@jorgebucaran
Copy link
Owner

Oops, my bad! You're totally right. Yeah, we don't have that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants