Skip to content

vercel dev not working -- ENOENT: no such file or directory, open '/home/user/projects/projectname/target/release/index' #176

Closed
@giuseppe-g-gelardi

Description

@giuseppe-g-gelardi

everything works if i deploy to prod however running locally does not work. it is not an issue with the index file name as ive tried it with "handler" and other names; i made sure to update the bin in the cargo.toml as well and it resulted in the same issue.

vercel.json:

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

cargo.toml:

[package]
name = "projectname"
version = "0.1.0"
edition = "2021"

[dependencies]
tokio = { version = "1", features = ["macros"] }
serde_json = { version = "1.0.106", features = ["raw_value"] }
vercel_runtime = "1.1.0"
url = "2.4.1"

[lib]
path = "src/lib.rs"

# [[bin]] # `cargo run --bin main` to run the main.rs file
# name = "main"
# path = "src/main.rs"

[[bin]]
name = "index"
path = "api/index.rs"

[[bin]] 
name = "hello"
path = "api/hello/handler.rs"

this is what logs in the terminal when i hit the endpoint:

> Building [email protected]:api/index.rs
(node:306471) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
[Error: ENOENT: no such file or directory, open '/home/user/projects/projectname/target/release/index'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/home/user/projects/projectname/target/release/index'
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions