Skip to content

install.js fails with EXDEV when /tmp is on a different filesystem (tmpfs) #1

Description

@Stibreant

Version: @tokens-studio/studio-cli@0.1.6
Environment: Fedora Linux (kernel 7.0.9), Node.js, /tmp mounted as tmpfs (the default on Fedora and many modern distros).

What happens: yarn install / npm install fails during the postinstall step:

Installing Studio CLI...
Downloading v0.1.6 for linux/amd64...
Checksum verified.
Extracting...
Installation failed: EXDEV: cross-device link not permitted, rename
'/tmp/studio-cli-install-/studio'
-> '.../node_modules/@tokens-studio/studio-cli/vendor/studio'

Root cause: install.js downloads and extracts the binary into os.tmpdir() (/tmp), then moves it into vendor/
with renameSync:

// Move binary to vendor directory
renameSync(extractedBinary, binaryPath);

rename(2) only works within a single filesystem. When /tmp is a separate mount (e.g. tmpfs), moving from /tmp to a project on disk crosses filesystems and throws EXDEV. This is increasingly common since many distros now mount /tmp as tmpfs by default.

Suggested fix: replace the cross-device renameSync with copy-then-delete:

const { copyFileSync, unlinkSync } = require("fs");
// Move binary to vendor directory (rename can't cross filesystems -> EXDEV)
copyFileSync(extractedBinary, binaryPath);
unlinkSync(extractedBinary);

(Alternatively, download/extract directly into the vendor/ directory and skip the move.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions