Questions tagged [shelljs]

For questions related to portable implementation of Unix shell commands for Node.js.

ShellJS is a portable (Windows/Linux/OS X) implementation of Unix on top of the

Usage

Install it using

$ npm install -g shelljs

And run scripts

$ shjs your_script_file

See also

82 questions
2
votes
1 answer

How to resolve permission denied error in shelljs and child-process module in node js?

I am using shelljs module to execute a bash file in node for a server side program. I even tried child-process module to execute the bash file. In both cases I got permission denied error. I am using linux(ubuntu disto). Here is the code…
Fleabag
  • 21
  • 2
2
votes
1 answer

Unable to have npm run a script that starts testcafe

I have a React project. I am trying to use an npm script that will run a test using testcafe. This test uses yargs and shelljs. When I run the tests outside of the package.json everything works fine, but when I use npm run test:local -- --api=local…
Ryan113
  • 676
  • 1
  • 10
  • 27
2
votes
1 answer

How to wait for a process in a JS NPM script using ShellJS

Node version: v.10.15.3 ShellJS version: 0.8.3 Operating system: Windows 10 Is it possible to wait for a process to finish and then start another one using the wait command in a windows system in a NodeJS script? I have tried the below, there are no…
Thabo
  • 1,303
  • 2
  • 19
  • 40
2
votes
2 answers

How do I use curly braces to create multiple directories in a single command via "shelljs"?

If you run this command in a Linux terminal: mkdir -p ./dist/{articles,scripts,stylesheets} It'll create the following folder tree (in the current directory): dist |- articles |- scripts |- stylesheets The problem occurs when I try to do the same…
Malekai
  • 4,765
  • 5
  • 25
  • 60
2
votes
1 answer

in an expressJS application, is it possible to collect data written to the console in real-time as a script is executing?

I'm trying to get the output of a bash script into an ExpressJS application where I can then send the data to a client. I created a script below that mimics the output of the actual script I will be using for my project. I want to be able to…
exloser
  • 37
  • 1
  • 7
2
votes
1 answer

Shelljs: how to cancel async process?

Given I do something like: shelljs.exec('someLongrunningCommand', {async: true}) How can I send a SIGINT or otherwise cancel this process in the same script?
csvan
  • 8,782
  • 12
  • 48
  • 91
2
votes
2 answers

How to have cli-spinner run during ShellJS command exec?

I'm currently trying to make a simple command-line node program that allows for me to easily create a boilerplate for a lot of the React/Redux applications that I make. I'm using ShellJS to execute console commands (I've tried using Node's…
TheOdd
  • 265
  • 1
  • 16
1
vote
1 answer

Promise not completing function before going into next

I am writing a promise, where the first part of my promise is doing a git clone in shelljs (node.js app). The second part of the promise is doing a git pull and more. But many times the promise starts the clone and then before that is over, jumps…
nb_nb_nb
  • 1,243
  • 11
  • 36
1
vote
1 answer

How to excute correct "sed" command in shelljs?

I am using shelljs to excute shell command to find and replace content in my configuration file. My configuration is file content like bellow, I want to find all string "" by the name of my clinic (This is a parameter that i passed from the client…
cauchuyennhocuatoi
  • 461
  • 3
  • 8
  • 21
1
vote
1 answer

Im trying to reduplicate the shelljs exec type execution in node

I was using shelljs before where i used to call a command like so: require('shelljs/global'); let res = exec('echo hello').stdout But I would like to achieve this in node without relying on shelljs. Thing is I've found examples with node and I'm…
TheMan68
  • 1,429
  • 6
  • 26
  • 48
1
vote
1 answer

ENONENT when executing shell script in Docker container

I am using node:12-alpine with a NodeJS backend calling ShellJS spawn command. It is supposed to run the shell script and I have verified and tested that it works locally. However, it is showing this error when it is running in the Docker…
Exceptions
  • 1,174
  • 2
  • 9
  • 28
1
vote
1 answer

NodeJS Execute a bash script that prompts for keyboard input

I am trying to execute an external bash script from nodejs. The script when executed from terminal, prompts for input, such as a password. When executing from nodejs, i can not get it to pause to read the input. Can not find any good info online…
mjs
  • 21,431
  • 31
  • 118
  • 200
1
vote
0 answers

Node execute shell command using variable content

I'm trying to run a shell command, using kubectl to run a deployment. The deployment configuration is stored in deploymentConfiguration variable. When I run one the following commands, I get an error. const shelljs = require('shelljs'); const…
David Faizulaev
  • 4,651
  • 21
  • 74
  • 124
1
vote
1 answer

Rename file in directory (Shelljs)

How can i rename a file into the same directory? When i run this i've got the following error: shell.cp('-R', './../../config/test.txt', './../../config/test1.txt'); cp: dest is not a directory (too many sources) I read the docs, but none of that…
Yakalent
  • 1,142
  • 2
  • 10
  • 18
1
vote
0 answers

Javascript order of executing lines of code

I am doing a Telegram Bot implemented in a Raspberry Pi 3. So my first idea is to use "telegraf" with Node.js and execute the code of the BOT there, but also with "shell.js" i would like to run some commands on Raspberry Terminal. The problem is…
Rafa Roman
  • 31
  • 1
  • 5