缺少必需的参数 'email'
missing required argument 'email'
缺少必需的参数'email'
你好,
我正在尝试使用 nodejs 创建一个命令行界面,因为我一直在努力学习它。
到现在为止一切都在计划中。
正如您应该知道的那样,因为我已经很清楚地说明了,我正在学习节点,所以我并没有完全坦率地面对所有错误。
我的界面用于管理客户并且一切正常,但是当我 运行
node commands.js add john doe 555-555-5555 john@gmail.com
通过命令行。这是我在 运行 处理它时得到的错误。
error: missing required argument 'email'
这是我的代码,如果有人想看一看。
const program = require('commander');
const {
addCustomer,
findCustomer
} = require('./index');
program
.version('1.0.0')
.description('Client Management System')
program
.command('add <firstname> <lastname> <dob> <phone> <email>')
.alias('a')
.description('Add a customer')
.action((firstname, lastname, dob, phone, email) => {
addCustomer({firstname, lastname, dob, phone, email});
}),
program
.command('find <name>')
.alias('f')
.description('Find a customer')
.action(name => findCustomer(name));
program.parse(process.argv);
您是否错过了 DOB 数据?
node commands.js add john doe 555-555-5555 john@gmail.com
应该是这样的
node commands.js add john doe 2011-1-2 555-555-5555 john@gmail.com
缺少必需的参数'email'
你好,
我正在尝试使用 nodejs 创建一个命令行界面,因为我一直在努力学习它。
到现在为止一切都在计划中。
正如您应该知道的那样,因为我已经很清楚地说明了,我正在学习节点,所以我并没有完全坦率地面对所有错误。
我的界面用于管理客户并且一切正常,但是当我 运行
node commands.js add john doe 555-555-5555 john@gmail.com
通过命令行。这是我在 运行 处理它时得到的错误。
error: missing required argument 'email'
这是我的代码,如果有人想看一看。
const program = require('commander');
const {
addCustomer,
findCustomer
} = require('./index');
program
.version('1.0.0')
.description('Client Management System')
program
.command('add <firstname> <lastname> <dob> <phone> <email>')
.alias('a')
.description('Add a customer')
.action((firstname, lastname, dob, phone, email) => {
addCustomer({firstname, lastname, dob, phone, email});
}),
program
.command('find <name>')
.alias('f')
.description('Find a customer')
.action(name => findCustomer(name));
program.parse(process.argv);
您是否错过了 DOB 数据?
node commands.js add john doe 555-555-5555 john@gmail.com
应该是这样的
node commands.js add john doe 2011-1-2 555-555-5555 john@gmail.com