'unable to load from yargs in nodejs

unable to load from yargs.argv. i am using npm latest version. its showing undefined in terminal when i use yargs.argv unable to load from yargs.argv. i am using npm latest version. its showing undefined in terminal when i use yargs.argv

unable to load from yargs.argv. i am using npm latest version. its showing undefined in terminal when i use yargs.argv



Solution 1:[1]

It's because there is no property argv on yargs.

If you read the documentation, they give examples like:

import yargs from 'yargs';

var argv = yargs(process.argv.slice(2));
console.log(argv.argv);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ben