Ask coding questions

← Back to all posts
How to install new packages
JohnS4 (2)

I know how to install packages through repls ways, in the side bar. And i also know how to install packages in the shell. But in the shell, sometimes I want to install a package that adds a new command to the terminal, like the package Slappey

I normally do npm i slappy and it is done. then to run the command i do slappey. it says it is not defined. I also know you have to do npm i slappey -g but it wont let me do that for some reason. any help?

Comments
hotnewtop
StringentDev (223)

@JohnS4 try npx slappy as it will install then run the packages.

PattanAhmed (1404)

@JohnS4 Hi,
Hit Ctrl + Shift + S to login to your Repl's Shell.
You will notice a new window under the console
Type there:-

npm i slappy

That will install the package manually.
If you want to install it automatically then, just import or use that package, it will automatically install the required files needed.

That's it
Thanks!

Hope this helps

CodeLongAndPros (1622)

install-pkg foo for the deb
npm i foo for Node
pip install foo for Py
wget && tar xzvf && cd && ./configure && make install for source

RohilPatel (1581)

Hey! I know why!

  1. Don't worry about using npm, just require the module and boom it installs
  2. Repl.it won't let you install things globally, so don't use the console in the first place!

Mark as correct by clicking the check mark if this helps in any way!

Coder100 (18071)

Hi! Just install it normally:

npm i slappy

but, in your package.json, add:

{
  /* "title": "...",
     ... */
  "scripts": {
    /* "test": "..." */
    "start": "[your command here]"
  }
}

Replace [your command here] with whatever is needed.

Then, in your .replit:

run = "npm run start"
ironblockhd (432)

replit automatically installs packages when you require() them in your code, but you can do CTRL+SHIFT+S to enter a shell where you can do that