Skip to content

Instantly share code, notes, and snippets.

@makenova
Last active December 15, 2021 06:23
Show Gist options
  • Save makenova/eaece72c61d3c5ac082e7ce62e98b2ea to your computer and use it in GitHub Desktop.
Save makenova/eaece72c61d3c5ac082e7ce62e98b2ea to your computer and use it in GitHub Desktop.
making `trash-cli` work on M1 hardware

I got the follwing error trying to use trash on my laptop(Apple M1 Pro).

Error: spawn Unknown system error -86
    at ChildProcess.spawn (node:internal/child_process:412:11)
    at spawn (node:child_process:698:9)
    at execFile (node:child_process:325:17)
    at node:child_process:235:21
    at chunkedExec ...
    ...

The first line made me think it was an issue related to the hardware so I pulled the repo and ran the build script ./build. The build script will create a binary and move it to the root of the repo and works without issue.

I replaced the macOS binary that I got when I ran npm i -g trash-cli.

cp ~/macos-trash/trash ~/.nvm/versions/node/v16.13.0/lib/node_modules/trash-cli/node_modules/trash/lib/macos-tra
sh

I use nvm so your node location might be different than mine but you should be able to find it with which node

➜  ~  which node
~/.nvm/versions/node/v16.13.0/bin/node
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment