Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

229
Views
cannot use prog module in caporal

I have a problem when i use prog module in caporal. i cannot use it because exist error 'cannot find module prog' . I have import with use 'import prog from "caporal"'. This is my code


#!/usr/bin/env node
const { program } = require("@caporal/core");
import prog from "caporal"; //not work

program

  .command("random", "Generate random alphanumeric")
  .option("--length", "length of string",prog.Int, 32)
  // .option("--letters", "allow letters or not", true)
  .action(({ logger, args, options }) => {
    // logger.info(options.length)
    let leng = options.length;
    logger.info(leng);
  });

program.run();

how i call prog module so that i cannot get error 'cannot find module prog'. Now i use latest version caporal

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You're using ES6 import syntax so you need to transpile it first to plain JS because Node doesn't support it. Try using Babel. Here is also a quick guide on how to setup it.

Either that or just write const prog = require('caporal') instead of import prog from "caporal"

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!