简体   繁体   中英

Error: ENOENT: no such file or directory, stat '/var/task/src/functions/public/home.html'

I'm trying to deploy my express based site on.netlify and my local directory look like this:

目录图像

and my.netlify.toml looks like this:

[build]
  functions="functions"

 [[redirects]]
   to="/.netlify/functions/_app/:splat"
   from="/*"
   status=200 

It works fine when I run it locally using netlify dev
but when I deploy the site on.netlify it shows this error:

在此处输入图像描述

I've even tried this and this approach but it isn't seem to work in my case
I'm a beginner so I'm not quite sure what mistake I'm making, so any help is greatly appreciated!

Try changing line 14: app.use("/", router) to

app.use('/.netlify/functions/_app', router);  // path must route to lambda

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM