berry icon indicating copy to clipboard operation
berry copied to clipboard

[Bug?]: /tmp noexec

Open kabo opened this issue 2 years ago • 1 comments

Self-service

  • [ ] I'd be willing to implement a fix

Describe the bug

This is probably not a bug but I think it's good to have a ticket here for people that run into this issue in the future.

If you're trying to run a script and getting "permission denied" back, the reason could be that yarn is trying to run something from /tmp and your /tmp directory is mounted with noexec.

The workaround I've found:

mkdir ~/.yarn/tmp
# now run the thing that wasn't working before, e.g.
TMPDIR=~/.yarn/tmp yarn depcheck

If it works you can update your .zshrc/.bashrc/whatever with an alias

alias yarn="TMPDIR=~/.yarn/tmp yarn"

Hopefully this helps someone.

To reproduce

This link to sherlock is broken, 404... image

to reproduce

yarn add --dev depcheck

package.json

  "scripts": {
    "depcheck": "depcheck . --ignores=depcheck,ts-node,'eslint-*','@types/*'",
   }
yarn depcheck

Returns "permission denied" if /tmp is mounted with noexec.

Environment

System:
    OS: Linux 6.4 Artix Linux
    CPU: (20) x64 13th Gen Intel(R) Core(TM) i9-13900H
  Binaries:
    Node: 18.16.1 - ~/.yarn/tmp/xfs-a1a545f3/node
    Yarn: 3.6.3 - ~/.yarn/tmp/xfs-a1a545f3/yarn
    npm: 9.5.1 - ~/n/bin/npm
  npmPackages:
    jest: ^29.6.4 => 29.6.4

Additional context

Perhaps this could be mentioned in some docs somewhere? It's not trivial for an unexperienced dev to troubleshoot this.

kabo avatar Aug 25 '23 09:08 kabo

I spent half a day trying to figure out what my issue was. Ended up being this. Yarn should def warn when this is the case

evman182 avatar Jan 09 '24 07:01 evman182