How to disable yarn interactive prompt for yarn upgrade












0















I am adding the yarn upgrade command to a bash file.
I want to run command to upgrade a specific package to a specific version.



yarn upgrade mypackage@5.9.5


But if the specific version is not found in remote npm repository currently yarn opens up a prompt to select from available versions, like this one:



Couldn't find any versions for "mypackage" that matches "5.9.5"
Please choose a version of "mypackage" from this list: (Use arrow keys)


This is not working well in the bash file. What I need is a simple error that package was not found and an exit with non 0 exit code.



Is it possible to do that?
Is there an option in yarn to disable this interactive selector or maybe there is a bash trick to disable this interaction and turn in into a simple exit code?










share|improve this question

























  • You could experiment with I/O redirection with yarn upgrade mypackage@5.9.5 </dev/null. You could also try to see if the --non-interactive flag happens to work with upgrade though it is not documented as such.

    – user268396
    Jan 18 at 23:03
















0















I am adding the yarn upgrade command to a bash file.
I want to run command to upgrade a specific package to a specific version.



yarn upgrade mypackage@5.9.5


But if the specific version is not found in remote npm repository currently yarn opens up a prompt to select from available versions, like this one:



Couldn't find any versions for "mypackage" that matches "5.9.5"
Please choose a version of "mypackage" from this list: (Use arrow keys)


This is not working well in the bash file. What I need is a simple error that package was not found and an exit with non 0 exit code.



Is it possible to do that?
Is there an option in yarn to disable this interactive selector or maybe there is a bash trick to disable this interaction and turn in into a simple exit code?










share|improve this question

























  • You could experiment with I/O redirection with yarn upgrade mypackage@5.9.5 </dev/null. You could also try to see if the --non-interactive flag happens to work with upgrade though it is not documented as such.

    – user268396
    Jan 18 at 23:03














0












0








0








I am adding the yarn upgrade command to a bash file.
I want to run command to upgrade a specific package to a specific version.



yarn upgrade mypackage@5.9.5


But if the specific version is not found in remote npm repository currently yarn opens up a prompt to select from available versions, like this one:



Couldn't find any versions for "mypackage" that matches "5.9.5"
Please choose a version of "mypackage" from this list: (Use arrow keys)


This is not working well in the bash file. What I need is a simple error that package was not found and an exit with non 0 exit code.



Is it possible to do that?
Is there an option in yarn to disable this interactive selector or maybe there is a bash trick to disable this interaction and turn in into a simple exit code?










share|improve this question
















I am adding the yarn upgrade command to a bash file.
I want to run command to upgrade a specific package to a specific version.



yarn upgrade mypackage@5.9.5


But if the specific version is not found in remote npm repository currently yarn opens up a prompt to select from available versions, like this one:



Couldn't find any versions for "mypackage" that matches "5.9.5"
Please choose a version of "mypackage" from this list: (Use arrow keys)


This is not working well in the bash file. What I need is a simple error that package was not found and an exit with non 0 exit code.



Is it possible to do that?
Is there an option in yarn to disable this interactive selector or maybe there is a bash trick to disable this interaction and turn in into a simple exit code?







node.js bash yarnpkg






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 18 at 22:55









tk421

3,40231426




3,40231426










asked Jan 18 at 15:58









DmitriDmitri

9,22182546




9,22182546













  • You could experiment with I/O redirection with yarn upgrade mypackage@5.9.5 </dev/null. You could also try to see if the --non-interactive flag happens to work with upgrade though it is not documented as such.

    – user268396
    Jan 18 at 23:03



















  • You could experiment with I/O redirection with yarn upgrade mypackage@5.9.5 </dev/null. You could also try to see if the --non-interactive flag happens to work with upgrade though it is not documented as such.

    – user268396
    Jan 18 at 23:03

















You could experiment with I/O redirection with yarn upgrade mypackage@5.9.5 </dev/null. You could also try to see if the --non-interactive flag happens to work with upgrade though it is not documented as such.

– user268396
Jan 18 at 23:03





You could experiment with I/O redirection with yarn upgrade mypackage@5.9.5 </dev/null. You could also try to see if the --non-interactive flag happens to work with upgrade though it is not documented as such.

– user268396
Jan 18 at 23:03












1 Answer
1






active

oldest

votes


















0














Use yarn upgrade with the --non-interactive flag. You will get a non-zero exit code if it fails



$ yarn upgrade webpack-merge@4.2.29 --non-interactive
yarn upgrade v1.13.0
[1/5] 🔍 Validating package.json...
[2/5] 🔍 Resolving packages...
error Couldn't find any versions for "webpack-merge" that matches "4.2.29"
info Visit https://yarnpkg.com/en/docs/cli/upgrade for documentation about this command.
$ echo $?
1





share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54257436%2fhow-to-disable-yarn-interactive-prompt-for-yarn-upgrade%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Use yarn upgrade with the --non-interactive flag. You will get a non-zero exit code if it fails



    $ yarn upgrade webpack-merge@4.2.29 --non-interactive
    yarn upgrade v1.13.0
    [1/5] 🔍 Validating package.json...
    [2/5] 🔍 Resolving packages...
    error Couldn't find any versions for "webpack-merge" that matches "4.2.29"
    info Visit https://yarnpkg.com/en/docs/cli/upgrade for documentation about this command.
    $ echo $?
    1





    share|improve this answer




























      0














      Use yarn upgrade with the --non-interactive flag. You will get a non-zero exit code if it fails



      $ yarn upgrade webpack-merge@4.2.29 --non-interactive
      yarn upgrade v1.13.0
      [1/5] 🔍 Validating package.json...
      [2/5] 🔍 Resolving packages...
      error Couldn't find any versions for "webpack-merge" that matches "4.2.29"
      info Visit https://yarnpkg.com/en/docs/cli/upgrade for documentation about this command.
      $ echo $?
      1





      share|improve this answer


























        0












        0








        0







        Use yarn upgrade with the --non-interactive flag. You will get a non-zero exit code if it fails



        $ yarn upgrade webpack-merge@4.2.29 --non-interactive
        yarn upgrade v1.13.0
        [1/5] 🔍 Validating package.json...
        [2/5] 🔍 Resolving packages...
        error Couldn't find any versions for "webpack-merge" that matches "4.2.29"
        info Visit https://yarnpkg.com/en/docs/cli/upgrade for documentation about this command.
        $ echo $?
        1





        share|improve this answer













        Use yarn upgrade with the --non-interactive flag. You will get a non-zero exit code if it fails



        $ yarn upgrade webpack-merge@4.2.29 --non-interactive
        yarn upgrade v1.13.0
        [1/5] 🔍 Validating package.json...
        [2/5] 🔍 Resolving packages...
        error Couldn't find any versions for "webpack-merge" that matches "4.2.29"
        info Visit https://yarnpkg.com/en/docs/cli/upgrade for documentation about this command.
        $ echo $?
        1






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered yesterday









        HanxueHanxue

        4,78665585




        4,78665585






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54257436%2fhow-to-disable-yarn-interactive-prompt-for-yarn-upgrade%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Callistus III

            Ostreoida

            Plistias Cous