gvm icon indicating copy to clipboard operation
gvm copied to clipboard

ERROR: Unrecognized command line argument: 'use'

Open ryan-williams opened this issue 8 years ago • 21 comments

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

ryan-williams avatar Mar 04 '16 22:03 ryan-williams

got the same issue, cannot figure out why.

gogames avatar Apr 18 '16 13:04 gogames

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.

gogames avatar Apr 18 '16 16:04 gogames

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"

sebito91 avatar Apr 27 '16 15:04 sebito91

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

bodepd avatar May 10 '16 01:05 bodepd

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?

bodepd avatar May 10 '16 01:05 bodepd

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?

njappboy avatar Jun 27 '16 16:06 njappboy

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

mingrammer avatar Sep 22 '16 06:09 mingrammer

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

SimonXming avatar Oct 11 '16 02:10 SimonXming

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.

mcandre avatar Oct 19 '16 19:10 mcandre

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"

bartoszmajsak avatar Oct 27 '16 11:10 bartoszmajsak

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.

scriptnull avatar Nov 06 '16 01:11 scriptnull

+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": []
}

fubarhouse avatar Dec 20 '16 07:12 fubarhouse

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

alonek1 avatar Aug 16 '17 08:08 alonek1

#!/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

liuziyuan avatar Dec 06 '17 04:12 liuziyuan

restart your terminal or

source  ~/.gvm/scripts/gvm

mosaic101 avatar Mar 14 '18 06:03 mosaic101

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

robinmitra avatar Apr 02 '19 19:04 robinmitra

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.

birdypme avatar Sep 06 '19 08:09 birdypme

Encountering it on v1.0.22

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

imulab avatar Jul 01 '23 09:07 imulab

source  ~/.gvm/scripts/gvm

it works for me

snxl avatar Jan 16 '24 02:01 snxl