简体   繁体   English

错误:ENOENT:没有这样的文件或目录,stat '/var/task/src/functions/public/home.html'

[英]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:我正在尝试在.netlify 上部署我的基于 express 的站点,我的本地目录如下所示:

目录图像

and my.netlify.toml looks like this: my.netlify.toml 看起来像这样:

[build]
  functions="functions"

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

It works fine when I run it locally using netlify dev当我使用netlify dev在本地运行它时它工作正常
but when I deploy the site on.netlify it shows this error:但是当我在 .netlify 上部署网站时,它显示了这个错误:

在此处输入图像描述

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尝试将第 14 行: app.use("/", router)更改为

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 webpack + express + angular 4错误“错误:ENOENT:没有这样的文件或目录,统计信息'C:\\ public \\ index.html' - webpack + express + angular 4 error "Error: ENOENT: no such file or directory, stat 'C:\public\index.html' 错误:ENOENT:没有这样的文件或目录,错误时统计“/public/main.html”(本机) - Error: ENOENT: no such file or directory, stat '/public/main.html' at Error (native) 错误:ENOENT:没有这样的文件或目录,stat '/home/arpit/.steampath' - Error: ENOENT: no such file or directory, stat '/home/arpit/.steampath' 错误:ENOENT:没有这样的文件或目录,统计 - Error: ENOENT: no such file or directory, stat 错误:Enoent:没有这样的文件或目录,状态为'D:\\ awesome-testindex.html' - Error :Enoent :no such file or directory ,stat 'D:\awesome-testindex.html' 错误:ENOENT:没有这样的文件或目录,stat ... .steampath - Error: ENOENT: no such file or directory, stat ... .steampath 错误:ENOENT,Heroku 中的 stat '/app/public/views/index.html' - Error: ENOENT, stat '/app/public/views/index.html' in Heroku 服务器给出错误:ENOENT:没有这样的文件或目录,stat 'F:\\web development\\calculator\\index.html' - server is giving Error: ENOENT: no such file or directory, stat 'F:\web development\calculator \index.html ' HEROKU 错误:ENOENT:没有这样的文件或目录,stat '/app/distpublic/index.html' - HEROKU Error: ENOENT: no such file or directory, stat '/app/distpublic/index.html' UnhandledPromiseRejectionWarning:错误:ENOENT:没有这样的文件或目录,stat'/assets/level.png' - UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, stat '/assets/level.png'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM