command is not adding using yarg npm packageHow to decide when to use Node.js?Where does npm install packages?How can I update NodeJS and NPM to the next versions?Find the version of an installed npm packagenpm throws error without sudoWhat is the difference between Bower and npm?What's the difference between dependencies, devDependencies and peerDependencies in npm package.json file?What is the --save option for npm install?NPM vs. Bower vs. Browserify vs. Gulp vs. Grunt vs. WebpackDo I commit the package-lock.json file created by npm 5?

How does an ARM MCU run faster than the external crystal?

Why are C64 games inconsistent with which joystick port they use?

Is cutting a DIY spline channel around the openings of our wood screen porch a dumb idea?

Tic-tac-toe for the terminal, written in C

Riley Rebuses that Share a Common Theme

How to respond to an upset student?

A Python Blackjack terminal based game

Should I disclose a colleague's illness (that I should not know about) when others badmouth him

Different circular sectors as new logo of the International System

Which is the common name of Mind Flayers?

How can people dance around bonfires on Lag Lo'Omer - it's darchei emori?

Is there an efficient way to replace text matching the entire content of one file with the entire content of another file?

Flying domestically in the US, is my State Issued ID all I need to get past security?

Is the Indo-European language family made up?

Employer asking for online access to bank account - Is this a scam?

Canon 70D often overexposing or underexposing shots

Should breaking down something like a door be adjudicated as an attempt to beat its AC and HP, or as an ability check against a set DC?

Approximate solution : factorial and exponentials

What are the benefits of cryosleep?

Seed ship, unsexed person, cover has golden person attached to ship by umbilical cord

Identify this in soil?

Why doesn't the Earth's acceleration towards the Moon accumulate to push the Earth off its orbit?

Command to Search for Filenames Exceeding 143 Characters?

I think I may have violated academic integrity last year - what should I do?



command is not adding using yarg npm package


How to decide when to use Node.js?Where does npm install packages?How can I update NodeJS and NPM to the next versions?Find the version of an installed npm packagenpm throws error without sudoWhat is the difference between Bower and npm?What's the difference between dependencies, devDependencies and peerDependencies in npm package.json file?What is the --save option for npm install?NPM vs. Bower vs. Browserify vs. Gulp vs. Grunt vs. WebpackDo I commit the package-lock.json file created by npm 5?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















iam trying to add command using yarg
but when i run my code my command is not added.
here is what iam trying



const yargs = require('yargs')

//create add command
yargs.command(
command: 'add',
describe: 'to add note',
handler: function()
console.log('note has been added')

)


run command:



PS C:UsersHPDesktopnodenotes-app> node app.js --help
Options:
--help Show help [boolean]
--version Show version number [boolean]


//no add command is added
//and also when i try to run my code by giving add as a argument (i.e node app.js add) nothing is shown



what should i do now?










share|improve this question




























    1















    iam trying to add command using yarg
    but when i run my code my command is not added.
    here is what iam trying



    const yargs = require('yargs')

    //create add command
    yargs.command(
    command: 'add',
    describe: 'to add note',
    handler: function()
    console.log('note has been added')

    )


    run command:



    PS C:UsersHPDesktopnodenotes-app> node app.js --help
    Options:
    --help Show help [boolean]
    --version Show version number [boolean]


    //no add command is added
    //and also when i try to run my code by giving add as a argument (i.e node app.js add) nothing is shown



    what should i do now?










    share|improve this question
























      1












      1








      1








      iam trying to add command using yarg
      but when i run my code my command is not added.
      here is what iam trying



      const yargs = require('yargs')

      //create add command
      yargs.command(
      command: 'add',
      describe: 'to add note',
      handler: function()
      console.log('note has been added')

      )


      run command:



      PS C:UsersHPDesktopnodenotes-app> node app.js --help
      Options:
      --help Show help [boolean]
      --version Show version number [boolean]


      //no add command is added
      //and also when i try to run my code by giving add as a argument (i.e node app.js add) nothing is shown



      what should i do now?










      share|improve this question














      iam trying to add command using yarg
      but when i run my code my command is not added.
      here is what iam trying



      const yargs = require('yargs')

      //create add command
      yargs.command(
      command: 'add',
      describe: 'to add note',
      handler: function()
      console.log('note has been added')

      )


      run command:



      PS C:UsersHPDesktopnodenotes-app> node app.js --help
      Options:
      --help Show help [boolean]
      --version Show version number [boolean]


      //no add command is added
      //and also when i try to run my code by giving add as a argument (i.e node app.js add) nothing is shown



      what should i do now?







      node.js npm yargs






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 24 at 6:52









      Saurabh KanswalSaurabh Kanswal

      611




      611






















          1 Answer
          1






          active

          oldest

          votes


















          0














          As per yargs docs, the method command takes 4 params and not an object;



          .command(cmd, desc, [builder], [handler])



          so your code should be something like (Notice, no more parentheses and object keys):



          //create add command
          yargs.command(
          'add',
          'to add note',
          function()
          console.log('note has been added')

          })


          If you're not passing the optional builder param, should probably use named params, for the handler function (not sure how yargs have named the params, but i guess it's handler) like



           ...
          handler = function()
          console.log('note has been added')






          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%2f55321403%2fcommand-is-not-adding-using-yarg-npm-package%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














            As per yargs docs, the method command takes 4 params and not an object;



            .command(cmd, desc, [builder], [handler])



            so your code should be something like (Notice, no more parentheses and object keys):



            //create add command
            yargs.command(
            'add',
            'to add note',
            function()
            console.log('note has been added')

            })


            If you're not passing the optional builder param, should probably use named params, for the handler function (not sure how yargs have named the params, but i guess it's handler) like



             ...
            handler = function()
            console.log('note has been added')






            share|improve this answer



























              0














              As per yargs docs, the method command takes 4 params and not an object;



              .command(cmd, desc, [builder], [handler])



              so your code should be something like (Notice, no more parentheses and object keys):



              //create add command
              yargs.command(
              'add',
              'to add note',
              function()
              console.log('note has been added')

              })


              If you're not passing the optional builder param, should probably use named params, for the handler function (not sure how yargs have named the params, but i guess it's handler) like



               ...
              handler = function()
              console.log('note has been added')






              share|improve this answer

























                0












                0








                0







                As per yargs docs, the method command takes 4 params and not an object;



                .command(cmd, desc, [builder], [handler])



                so your code should be something like (Notice, no more parentheses and object keys):



                //create add command
                yargs.command(
                'add',
                'to add note',
                function()
                console.log('note has been added')

                })


                If you're not passing the optional builder param, should probably use named params, for the handler function (not sure how yargs have named the params, but i guess it's handler) like



                 ...
                handler = function()
                console.log('note has been added')






                share|improve this answer













                As per yargs docs, the method command takes 4 params and not an object;



                .command(cmd, desc, [builder], [handler])



                so your code should be something like (Notice, no more parentheses and object keys):



                //create add command
                yargs.command(
                'add',
                'to add note',
                function()
                console.log('note has been added')

                })


                If you're not passing the optional builder param, should probably use named params, for the handler function (not sure how yargs have named the params, but i guess it's handler) like



                 ...
                handler = function()
                console.log('note has been added')







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 24 at 10:41









                15560897741556089774

                3,5851421




                3,5851421





























                    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%2f55321403%2fcommand-is-not-adding-using-yarg-npm-package%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

                    Obelisk of Theodosius Contents History Description Notes Bibliography Further reading External links Navigation menuAge of spirituality : late antique and early Christian art, third to seventh centuryOver 60 picturesObelisks of the World41°00′21.24″N 28°58′31.43″E / 41.0059000°N 28.9753972°E / 41.0059000; 28.97539727724550-7235741376235741376

                    밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

                    1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴