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

"unbound variable" error when running nvm from post-receive hook #1363

Closed
Znarkus opened this issue Dec 25, 2016 · 5 comments
Closed

"unbound variable" error when running nvm from post-receive hook #1363

Znarkus opened this issue Dec 25, 2016 · 5 comments
Labels
needs followup We need some info or action from whoever filed this issue/PR.

Comments

@Znarkus
Copy link

Znarkus commented Dec 25, 2016

Running (cd /home/user/app2/2016-12-25-19.28.59 && nvm i && nvm use)

remote: Found '/home/user/app2/2016-12-25-19.28.59/.nvmrc' with version <6.9.2>
remote: /home/user/.nvm/nvm.sh: line 2250: PROVIDED_REINSTALL_PACKAGES_FROM: unbound variable
remote: /home/user/.nvm/nvm.sh: line 2253: PROVIDED_REINSTALL_PACKAGES_FROM: unbound variable

I removed this from .bashrc to make sure environment is setup properly.

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

Any idea what I'm doing wrong?

@PeterDaveHello
Copy link
Collaborator

I think you didn't provide enough info @Znarkus, what's the define of post-receive hook here? What's the shell been using here?

@Znarkus
Copy link
Author

Znarkus commented Dec 25, 2016

Sorry just upgraded 0.32.0 -> 0.32.1 and the error changed to:

remote: /home/user/.nvm/nvm.sh: line 374: NVM_FLAVOR: unbound variable
remote: /home/user/.nvm/nvm.sh: line 2375: NVM_INSTALL_SUCCESS: unbound variable

Post-receive hook:

#!/bin/bash

source $HOME/.bashrc

set -u
set -e

NEW_DIR="$HOME/app2/`date +%Y-%m-%d-%H.%M.%S`"
CURRENT_DIR=$HOME/app2/current
REPO_DIR="$HOME/app2/repo"
GIT_DIR="$HOME/project.git"

mkdir -p $REPO_DIR

git --work-tree="$REPO_DIR" --git-dir="$GIT_DIR" checkout -f
git --work-tree="$REPO_DIR" checkout-index -a --prefix="$NEW_DIR/"
(cd "$NEW_DIR" && nvm i && nvm use && npm i --production && npm run build)
rm -f "$CURRENT_DIR"
ln -s "$NEW_DIR" "$CURRENT_DIR"
sudo restart project

Bash is the shell on the local computer I'm doing git push from, and bash is the default for the remote user.

@PeterDaveHello
Copy link
Collaborator

@Znarkus would you please how did you install and upgrade nvm?

@Znarkus
Copy link
Author

Znarkus commented Dec 25, 2016

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash

@ljharb
Copy link
Member

ljharb commented Dec 25, 2016

@Znarkus what bash options do you have set? what does nvm debug output? I see in your hook that you have the u and e options set, but I'm not able to reproduce these errors with that.

Either way, I can address the NVM_INSTALL_SUCCESS and NVM_FLAVOR errors.

@ljharb ljharb added the needs followup We need some info or action from whoever filed this issue/PR. label Dec 25, 2016
@ljharb ljharb closed this as completed in 60239e3 Dec 25, 2016
@ljharb ljharb reopened this Dec 26, 2016
@ljharb ljharb closed this as completed in 853afbf Dec 27, 2016
edwmurph pushed a commit to edwmurph/nvm that referenced this issue Apr 9, 2018
edwmurph pushed a commit to edwmurph/nvm that referenced this issue Apr 9, 2018
…bles aren’t called unchecked.""

This reverts commit a8c4650.

Fixes nvm-sh#1363.
edwmurph pushed a commit to edwmurph/nvm that referenced this issue Apr 9, 2018
…ed unchecked.

This commit is follow up for 853afbf.
Fixes remaining bug in nvm-sh#1363
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs followup We need some info or action from whoever filed this issue/PR.
Projects
None yet
Development

No branches or pull requests

3 participants