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

ERROR: Unrecognized command line argument: 'use' #188

Open
ryan-williams opened this issue Mar 4, 2016 · 19 comments
Open

ERROR: Unrecognized command line argument: 'use' #188

ryan-williams opened this issue Mar 4, 2016 · 19 comments

Comments

@ryan-williams
Copy link

After previously having successfully run gvm use go1.6:

$ gvm install go1.5.3
Installing go1.5.3...
 * Compiling...
$ gvm use go1.5.3
ERROR: Unrecognized command line argument: 'use'
$ gvm install go1.4.3
Installing go1.4.3...
 * Compiling...
$ gvm use go1.4.3
ERROR: Unrecognized command line argument: 'use'
$ gvm version
Go Version Manager v1.0.22 installed at /Users/ryan/.gvm
@gogames
Copy link

gogames commented Apr 18, 2016

got the same issue, cannot figure out why.

@gogames
Copy link

gogames commented Apr 18, 2016

I am deploying go app from fabric and it is something like:

def deploy():
    local('gvm use go1.6')
    # do something to deploy

However it is not able to use specific version go. Please help to resolve this issue.

@sebito91
Copy link

Try this out, I just added it to my config with the same issues and seems to be working now.

FILE: ~/.gvm/scripts/gvm-default

. "$GVM_ROOT/scripts/env/use"

@bodepd
Copy link

bodepd commented May 10, 2016

Running into the same thing here when I try to setup gvm from a bash script.

@bodepd
Copy link

bodepd commented May 10, 2016

I peeked a little more. The issue is in the code that checks to see if subcommands are valid:

if [ -f "$GVM_ROOT/scripts/$command" ];

(looking for scripts/use which doesn't exist, the script does exist at $GVM_ROOT/scripts/env/use)

what is the difference between these two directories?

@njappboy
Copy link

Same issue here. When trying to run bash shell scripts via the vagrant non-privileged user (vagrant user). @bodepd did you ever resolve the issue?

@mingrammer
Copy link

mingrammer commented Sep 22, 2016

I have same issue. When i use the 'gvm use' or 'gvm pkgset use' in bash script, the error is occur

@SimonXming
Copy link

Are you guys installed 'zsh' version but using in 'bash' or instead?

@mcandre
Copy link

mcandre commented Oct 19, 2016

Same error on my machine, a fresh macOS 10.12 Sierra install. Using bash 4.4 from Homebrew, and the provided gvm bash curl install command.

I think direnv is getting in the way, see direnv/direnv#128.

@bartoszmajsak
Copy link

I'm also struggling with the same problem when trying to use gvm use in the shell script. Workaround which works for me is to source it in the script itself.

[[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm"

@scriptnull
Copy link

Using Ubuntu 14.04 and default terminal.

on executing gvm use go1.4 on terminal, it works.

But fails with the above error, if the command is used in a makefile or shell script.

@fubarhouse
Copy link

fubarhouse commented Dec 20, 2016

+1

I've made a wonderful, wonderful Ansible automation role which doesn't seem to work, but executing from the shell works fine. Here's the output - but I really want a solution so I can publish this for the world (and me) to use.

fatal: [localhost]: FAILED! => {
    "changed": true,
    "cmd": "gvm use go1.7.4 --default",
    "delta": "0:00:00.032705",
    "end": "2016-12-20 07:37:11.950701",
    "failed": true,
    "invocation": {
        "module_args": {
            "_raw_params": "gvm use go1.7.4 --default",
            "_uses_shell": true,
            "chdir": null,
            "creates": null,
            "executable": null,
            "removes": null,
            "warn": true
        },
        "module_name": "command"
    },
    "rc": 1,
    "start": "2016-12-20 07:37:11.917996",
    "stderr": "ERROR: Unrecognized command line argument: 'use'",
    "stdout": "",
    "stdout_lines": [],
    "warnings": []
}

@alonek1
Copy link

alonek1 commented Aug 16, 2017

same error here, raspberian works from terminal but not from shell or python code !

@liuziyuan
Copy link

#!/bin/sh
mkdir $1
cd $1
gvm pkgset create --local
gvm pkgset use --local
#####

this is a base shell script. has the ERROR: Unrecognized command line argument: 'use' issue.
but the gvm pkgset use --local command could run on ubuntu terminal

@mosaic101
Copy link

restart your terminal or

source  ~/.gvm/scripts/gvm

@robinmitra
Copy link

This is still happening! Doesn't seem to work in a Makefile even after sourcing gvm.

v1v added a commit to v1v/hey-apm that referenced this issue May 3, 2019
@birdypme
Copy link

birdypme commented Sep 6, 2019

restart your terminal or

source  ~/.gvm/scripts/gvm

This fixed my Jenkins build, but having to do it manually looks weird.

Before that I also tried to use a local zsh by adding #!/usr/bin/zsh to my shell script, but I'm still getting the "Unrecognized command line argument: 'use'" message.

@imulab
Copy link

imulab commented Jul 1, 2023

Encountering it on v1.0.22

A temporary fix would be to cp ~/.gvm/scripts/env/use ~/.gvm/scripts and give it execution rights.

@snxl
Copy link

snxl commented Jan 16, 2024

source  ~/.gvm/scripts/gvm

it works for me

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