gleam-lang/gleam

`gleam build` doesn't have permission to link `priv` on Windows

Open

#3,015 opened on Apr 20, 2024

View on GitHub
 (8 comments) (3 reactions) (0 assignees)Rust (21,417 stars) (960 forks)batch import
good first issuehelp wantedhigh priority

Description

On Windows running gleam build on a project with a priv directory will error. This seems to be caused by a Windows-specific symlink behaviour. https://blogs.windows.com/windowsdeveloper/2016/12/02/symlinks-windows-10/

You can enable "Developer Mode", which will grant the symlink permission. image If there's no easy way to fix this, then printing out a warning to enable this setting would probably be okay.

Using Gleam v1.1.0

Reproducing:

gleam new project_name
cd project_name
mkdir priv
gleam build
> gleam build
Downloading packages
 Downloaded 2 packages in 0.02s
  Compiling gleam_stdlib
  Compiling gleeunit
  Compiling project_name
error: File IO failure

An error occurred while trying to link this file:

    C:\Users\USERNAME\Desktop\project_name\build\dev\erlang\project_name\priv

The error message from the file IO library was:

    A required privilege is not held by the client. (os error 1314)

Contributor guide