rust icon indicating copy to clipboard operation
rust copied to clipboard

Error: ENOENT: no such file or directory when building in vercel dev

Open fanoway opened this issue 2 years ago • 5 comments

My handlers build and work properly when using vercel deploy. However using the local vercel dev results in the following error. The target\release\deps directory exists, however the rmetaXXXXX file does not, other files exist with a similair but different name.

[Error: ENOENT: no such file or directory, scandir 'C:\Users\user-name\Documents\project-name\target\release\deps\rmeta8XbjCX'] { errno: -4058, code: 'ENOENT', syscall: 'scandir', path: 'C:\\Users\\user-name\\Documents\\project-name\\target\\release\\deps\\rmeta8XbjCX' }

My vercel.json file looks like { "functions": { "api/*/*.rs": { "runtime": "[email protected]" } } }

fanoway avatar Mar 15 '23 02:03 fanoway

Hey there 👋🏻 . Seems like this is a Windows-specific error. Were you using one of the examples or do you have a reproduction repo so I can look into fixing this issue?

ecklf avatar Mar 15 '23 09:03 ecklf

I think I managed to resolve the issue. The binary name resolving didn't include .exe which is added on Windows. In case this issue is not resolved by using [email protected] feel free to reopen.

ecklf avatar Mar 15 '23 16:03 ecklf

Thanks. I am running windows 10 for reference.

I switched to the beta.2 version. and it resulted in the same error.

A bit more info for you. The rmeta dir its looking for does not exist, but there are other rmeta dirs with different names

My repo can be found here

fanoway avatar Mar 15 '23 22:03 fanoway

Will have a look at it tomorrow

ecklf avatar Mar 15 '23 22:03 ecklf

The project was missing a vercel.json file (note that the glob in your initial post missed an *). Also make sure to add target to .vercelignore to prevent uploading it.

{
    "functions": {
        "api/**/*.rs": {
            "runtime": "[email protected]"
        }
    }
}

After applying the above I could not reproduce the error when running vercel dev. CleanShot 2023-03-16 at 09 37 52

$ rustup show
Default host: aarch64-pc-windows-msvc
rustup home:  C:\Users\ecklf\.rustup

stable-aarch64-pc-windows-msvc (default)
rustc 1.68.0 (2c8cc3432 2023-03-06)

ecklf avatar Mar 16 '23 08:03 ecklf