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

You have $NVM_DIR set to \"/home/user/.nvm\", but that directory does not exist. #3

Closed
magick93 opened this issue Feb 20, 2019 · 6 comments
Assignees
Labels

Comments

@magick93
Copy link

magick93 commented Feb 20, 2019

Hello

When I run this role, using:

  - include_role: 
      name: ansible-role-nvm
    vars:
      nodejs_version: "4.8.0"

I get the following:

fatal: [127.0.0.1]: FAILED! => {"changed": true, "cmd": "wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | NVM_SOURCE= NVM_DIR=/home/user/.nvm PROFILE=.bashrc bash", "delta": "0:00:00.297033", "end": "2019-02-21 09:56:42.735199", "msg": "non-zero return code", "rc": 1, "start": "2019-02-21 09:56:42.438166", "stderr": "You have $NVM_DIR set to \"/home/user/.nvm\", but that directory does not exist. Check your profile files and environment.", "stderr_lines": ["You have $NVM_DIR set to \"/home/user/.nvm\", but that directory does not exist. Check your profile files and environment."], "stdout": "", "stdout_lines": []}
@morgangraphics
Copy link
Owner

morgangraphics commented Feb 21, 2019

The error clearly states that the location where you are trying to install NVM doesn't exist. Does the user "user" home directory actually exist on the machine you are targeting? The role looks for the directory via an Ansible environment variable "{{ansible_env.HOME}}/.nvm" and attempts to install it there.

Run this command on your machine cut -d: -f1 /etc/passwd | sort

If userisn't in that list then that is the issue.

sys
...
systemd-timesync
usbmux
                <-- missing
uucp
uuidd
whoopsie
www-data

Let me know.

@magick93
Copy link
Author

Yes, that user user does exist.

Thanks

@morgangraphics
Copy link
Owner

Ok. Can you ensure that the user that is running the task is actually the "user" user?

You an add a command task to the playbook.

- name: Who AM I
  command: whoami

Does the user directory have the correct permissions?

755 rwxr-xr-x

What OS are you trying to provision on?

@magick93
Copy link
Author

Yes, it is the user user who is running the playbook.

I am debugging, using:

- name: get the username running the deploy
  become: false
  local_action: command whoami
  register: username_on_the_host

- debug: var=username_on_the_host

which produces:

ok: [127.0.0.1] => {
    "username_on_the_host": {
        "changed": true, 
        "cmd": [
            "whoami"
        ], 
        "delta": "0:00:00.001775", 
        "end": "2019-02-21 15:49:09.958252", 
        "failed": false, 
        "rc": 0, 
        "start": "2019-02-21 15:49:09.956477", 
        "stderr": "", 
        "stderr_lines": [], 
        "stdout": "user", 
        "stdout_lines": [
            "user"
        ]
    }
}

I am able to proceed with using the ansible-role-nvm by preceding it wtih:

  - name: Creates directory
    file:
      path: /home/user/.nvm
      state: directory

What OS are you trying to provision on?

Ubuntu 18.10.

@morgangraphics
Copy link
Owner

Ok, this has not been tested on Ubuntu 18.10 yet so I will have to look into it this weekend.

Glad you found a work around. In fact it's probably a good idea for the role to test if the .nvm directory exists before hand before trying to install. So, I will investigate the issue and update the role accordingly.

@morgangraphics morgangraphics self-assigned this Feb 25, 2019
@morgangraphics
Copy link
Owner

Addressed in PR#4

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

No branches or pull requests

2 participants