'How to get arguements from CLI with process.argv and pass it to npm?
I want to pass arguements to npm script
package.json:
"scripts": {
"start": "node list.js <path>",
{
when I execute command
npm start "C:\Users\santo\Downloads\service_account.json"
I want to pass the path to the list.js
list.js:
const process = require('process');
var args = process.argv;
args.forEach((val, index) => {
console.log(`${index}: ${val}`);
});
I am getting erroe saying Error: Cannot find module
How can I solve it and pass the data?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
