Ask coding questions

← Back to all posts
Run With Shell
h
SilentDragonCod (0)

Is there a way to make it that if you click the run button it will run a command in the shell because I can only run my project with a command in the shell 'npm run dev'. I can't run this command in the console.

Answered by realTronsi (911) [earned 5 cycles]
View Answer
Comments
hotnewtop
realTronsi (911)

sure, use bash

.replit (configures the run button)

run="bash main.sh"

main.sh

npm run dev
# etc

If you want to run commands, use the shell. There should be a default tab called the shell, or open it using ctrl shift s

RYANTADIPARTHI (6001)

or you can run the command yourself in the shell.

Wumi4 (486)

There is, create a file called .replit, then add this:

run = "npm run dev"

It will run the command npm run dev every time you click the run button.

Or if you want to run a shell command without needed to click the run button, there's already a tab called Shell next to the Console tab. You should see it immediately.

SilentDragonCod (0)

@Wumi4 i dont have a file created .replit, and is it also possible to do it without opening shell? it wont run 24/7 now

Wumi4 (486)

@SilentDragonCod Have you read the first sentence? I say you to create the .replit file, because that file is an optional thing. If you don't know how, on the left of your Repl, there is the file browser, for browsing files of course. At the top of it, you will see a button called Create File or something like that. click on that, then type the name of it, like .replit.

And Wdym at and is it also possible to do it without opening shell? anyway?