您的位置: 首页 > 文章 > webStrom用node写的html页面Failed to load resource: the server responded with a status of 404 (Not Found) webStrom用node写的html页面Failed to load resource: the server responded with a status of 404 (Not Found) 分类: 文章 • 2024-08-26 16:37:46 webStrom 用node写的html页面 1、页面显示的错误信息,因为找不到js和css文件 2、网页点击右键检查后看console输出 显示的错误 3、控制台输出 4、我原来把页面放到的是views目录下,就会上述的错误,当我把index.html放到public目录下后就可以正常显示页面了,但是需要把app.js里面的app.set(‘views’,path.join(__dirname, ‘/views’));改为app.set(‘views’,path.join(__dirname, ‘/public’)); 原因:express生成的框架中默认static是public