Tutorial: How to install any package from apt-get on Glitch

Tutorial: How to install packages from apt-get on Glitch

  1. 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
  1. 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.

  2. Modify the “scripts” section of package.json to look like this:

    "scripts": {
      "start": "bash start.sh",
      "run": "<the command originally.in 'start'>"
    }
  1. 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 the notroot 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.

Tip: If you want to use the named packages in your path or inside Glitch console, add source /tmp/notroot/bashrc to your “.env” file.