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
0
votes
2 answers

Do something based on echo text

I am using shelljs to git clone in my node app. I want to only do something once the clone is successful. So wanted to so something like this: shell.exec(`git clone https://myrepo.git; echo "cloned"`); This returns cloned once my repo is cloned on…
nb_nb_nb
  • 1,243
  • 11
  • 36
0
votes
1 answer

Angular / node.js how to copy the app version from package.json to anothe non json file

Within my Angular app , and while building it , i ve to catch the app version , which is inside my package.json file and copy it to another file which would be not a json file. My package.json file : { "name": "my app", "author": "ME", …
firasKoubaa
  • 6,439
  • 25
  • 79
  • 148
0
votes
1 answer

How to grab last 3 characters of a string that contains a given substring

I wondered how I could only grab the last 3 chars of a string only containing a given substring. For example, I want to grab every -%} that does have the substring "assign" or "liquid" preceding it. In this case, I'd only want the -%} from lines 1,…
Katie L
  • 3
  • 1
0
votes
1 answer

How to run a script to execute to a node a specific folder

There are two or more projects on node js. For example, the first project is located in the folder: "/project/one", inside one of the js functions we execute: const projectTwoPath = "/project/two"; exec(`sh ${projectTwoPath}/projectRun.sh`,…
Van Hemer
  • 1
  • 1
0
votes
1 answer

Yeoman outputs warnings running a generator

I am implementing a Yeoman generator, it works but when I run it I am getting a lot of undesired warnings as shown in this image: I created the most basics generator in Javascript, it only contains the package.json, the index.js in the…
Diego Satizabal
  • 119
  • 1
  • 7
0
votes
1 answer

Improper Privilege Management in shelljs - https://github.com/advisories/GHSA-4rq4-32rv-6wp6

It seems I can stuck in an npm loop. When I run npm install or npm update I am told that I have "2 high severity vulnerabilities" and when I run an npm audit I am told that "Improper Privilege Management in shelljs -…
zazvorniki
  • 3,512
  • 21
  • 74
  • 122
0
votes
1 answer

How can you find out what event a stdout message is coming from? NodeJS

I'm currently working on a script where I want to be able to read the messages coming from child processes spawned from ShellJS NPM package, which uses NodeJS child_process. Currently, I am able to read most of the logs with the stdout.on("data",…
Kennyist
  • 58
  • 5
0
votes
1 answer

how to answer questions in cmd using shelljs

I'm putting together a script to create certificates for my devices, I thought I'd use shelljs to run these commands. I created a basic command for certificate generation, but the script stops running when cmd has a question, as in the…
Vinicius
  • 15
  • 4
0
votes
1 answer

How can I run a local .bat file with node.js

Im using a discord.js bot to run a local .bat file, upon running the command, it runs the .bat file, but then it renders the bot useless as commands after that do absolutely nothing, no reply from the bot. My understanding of it is that its…
Happy Lama
  • 31
  • 6
0
votes
0 answers

Shelljs - awk not replacing given format

I've spent the past hours trying to figure out what the issue with the code below is. What I am trying to do is write the content of a request body to a file, and then remove the \ns from there with enter (I am saving markdown and I need the double…
David Buzatu
  • 624
  • 8
  • 18
0
votes
0 answers

shelljs.exec(`sudo pkill -P ${process.pid}` did not work in ubuntu

I have a python module that work with webcam by opencv in ubuntu. I should execute it from nodejs so I use shelljs package and run shell.exec('sudo pkill -P ${pythonProcess.pid}'). It does not close webcam otherwise it working in terminal of ubuntu.…
r.a.shehni
  • 350
  • 1
  • 4
  • 11
0
votes
0 answers

How to constantly get status of docker containers and show in react app

I have created a react app to start/reset docker some containers. I do this with reactstrap, shelljs and express. Now I also want to get feedback like if those containers currently starting, if its up or if it's removed/not existing. I think one way…
edass
  • 45
  • 7
0
votes
1 answer

Returning a value trough ShellJS

For my project I need a specific value from a token that I get trough executing a shell file trough shell JS. The token is in the output of the shellJS. My problem is that I cannot return my the value in the function to use the token elsewhere. Here…
0
votes
1 answer

SSH Connection gets refused when executing bash script within Node.js

So my structure looks like this: main.js folder1/ jsFile1.js folder2/ jsFile2.js bashFile.sh main.js requires jsFile1.js which then requires and runs jsFile2.js. jsFile2.js then finally runs bashFile.sh using ShellJS and passes three…
error2507
  • 3
  • 1
0
votes
0 answers

Using Node-Cron to Run a JS file with Node

I am attempting to set up a task using node-cron and shelljs to run a js file with node. Am I setting this up correctly? const cron = require('node-cron'); const shell = require('shelljs'); cron.schedule('0 0 0 * * *', () => { …
Nick
  • 466
  • 1
  • 6
  • 12