{
  "author": "Zed A. Shaw",
  "date": "Dec 30, 2022",
  "has_image": false,
  "tag": "Advice",
  "icon": "bomb",
  "summary": "Short tips, tricks, and common footguns you'll run into with solutions."
}
------
# Tips, Tricks, & Footguns

This is just a list of short bits of advice that solve various problems you'll run into.  A lot of these are taken out of the other documentation and then simplified for a quick note.  Many times you can search for the error message that's causing you problems and there will be a solution.  The reason this file exists is because there's all sorts of little things that don't deserve their own page, but still need solutions published.

## Install Error with Playwright

In theory you shouldn't need playwright to download browsers, so just tell it not to.

```shell
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm install
```

This isn't as needed on Linux as OSX, because the Playwright project forces people to upgrade their OS by claiming all versions of their project can't support any slightly older Safari versions.  You also just don't need Safari, so skip the download.

## Errors Related to `node-gyp`

If you get errors related to `node-gyp` then read [this github page](https://github.com/nodejs/node-gyp/blob/main/docs/Updating-npm-bundled-node-gyp.md). It says that `npm` updates don't update the `node-gyp` it uses internally. Depending on your version you will have to run different commands, but this works for 7,8, and 9 versions:

```shell
npm explore npm/node_modules/@npmcli/run-script -g -- npm_config_global=false npm install node-gyp@latest
```

## Errors with `node-pre-gyp`

There's also an issue with installing `node-pre-gyp` where it seems you need to install @mapbox/node-pre-gyp and also `node-pre-gyp`.  I have to install both but you might be able to use `module-alias` as described in [this blog post](https://smellycode.com/require-with-aliases/).

## Linux Console Error on `bando.js init`

On some versions of Linux you may get a weird error `Couldn't get a file descriptor referring to the console` when the `commands/init.js` script tries to run Node's `execSync`.  Currently I have no idea why this error happens, as it doesn't happen on any Linux I run.  If you have an idea what's causing this, please let me know.
