android-js / androidjs

Platform to build android app using node js
MIT License
466 stars 109 forks source link

Error: process.stdout.clearLine() #256

Closed IhsanDevs closed 2 years ago

IhsanDevs commented 2 years ago

Getting this error when building app from Symfony Proccess :

/opt/homebrew/lib/node_modules/androidjs-builder/modules/Html/ProgressBar.js:35
        process.stdout.clearLine();
                       ^

TypeError: process.stdout.clearLine is not a function
    at LoadingBar.clear (/opt/homebrew/lib/node_modules/androidjs-builder/modules/Html/ProgressBar.js:35:24)
    at LoadingBar.next (/opt/homebrew/lib/node_modules/androidjs-builder/modules/Html/ProgressBar.js:23:14)
    at Timeout._onTimeout (/opt/homebrew/lib/node_modules/androidjs-builder/modules/Html/ProgressBar.js:42:18)
    at listOnTimeout (node:internal/timers:564:17)
    at process.processTimers (node:internal/timers:507:7)

Node.js v18.10.0

I want to building app using my Laravel custom command and will execute a command for building app using Symfony Proccess. This is my PHP Laravel code :

<?php 

// ...

public function handle()
{       
    // run command
    $build = new Process(['androidjs','build','--release','-f'], base_path('androidjs-app'));

    $build->run(function ($type, $buffer) {
        if (Process::ERR === $type) {
            echo 'ERR > '.$buffer;
        } else {
        echo $buffer;
        }
});

    return Command::SUCCESS;
}

How to fix this problem? Desktop:

m0n4 commented 2 years ago

quick fix: locate install folder for androidjs-builder with npm list -g usually: _/usr/local/lib/nodemodules or _/usr/lib/nodemodules in your case: _/opt/homebrew/lib/nodemodules cd into it and remove offending lines:

sudo find androidjs-builder -type f -exec sed -i -e "s/process.stdout.clearLine();//g" {} \;
sudo find androidjs-builder -type f -exec sed -i -e "s/process.stdout.cursorTo(0);//g" {} \;

to remove the progess bar too:

sudo find androidjs-builder -type f -exec sed -i -e "s/state.progress.start();//g" {} \;
sudo find androidjs-builder -type f -exec sed -i -e "s/progress.start();//g" {} \;