Tutorial: How to install packages from apt-get on Glitch
- Create a file named
start.sh
. Copy these contents inside here:
touch /tmp/INSTALLED_PACKAGES
PACKAGES=""
if [ ! "$PACKAGES" == "$(cat /tmp/INSTALLED_PACKAGES)" ]; then
cd /tmp
rm -rf notroot
git clone https://github.com/CrazyPython/notroot
source notroot/bashrc
notroot install $PACKAGES
echo $PACKAGES > /tmp/INSTALLED_PACKAGES
else
source /tmp/notroot/bashrc
fi
cd
pnpm install --reporter silent --prefer-offline --audit false
npm run-script run --silent
-
List the names of the packages you want to install from apt-get, separated by spaces, within the double quotes in the line starting with
PACKAGES
. -
Modify the “scripts” section of package.json to look like this:
"scripts": {
"start": "bash start.sh",
"run": "<the command originally.in 'start'>"
}
- If you receive an error like “dynamic library libnl-3.so.200 not found”, then the package you’re trying to install requires another package that’s not installed. You’ll want to search for the library using
apt-get update && apt cache search name
, and add the found package name to thenotroot install
line in start.sh.
Note: Modifying start.sh does not restart the Glitch app, so you’ll need to modify your JavaScript code in order to run start.sh.