How to install new packages
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?
The package was slappy
@JohnS4 try npx slappy
as it will install then run the packages.
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
Hey! I know why!
- Don't worry about using npm, just require the module and boom it installs
- 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!
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"
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
@JohnS4 Hi,
Hit Ctrl + Shift + S to login to your Repl's Shell.
You will notice a new window under the console
Type there:-
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