错误:ENOENT,打开favicon.ico [英] Error: ENOENT, open favicon.ico

查看:349
本文介绍了错误:ENOENT,打开favicon.ico的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新手节点和快递

我创建了一个快速样本项目,首先写作

I created a express sample project by first writing

express test1

然后我做了

npm install

应用程序我正在做节点app.js,但是我收到这个错误

For testing the application i am doing node app.js, but i am getting this error


错误:ENOENT,打开
'/ home / test1 / node_modules / express / node_modules / connect / node_modules / static-favicon /../ public / favicon.ico'

Error: ENOENT, open '/home/test1/node_modules/express/node_modules/connect/node_modules/static-favicon/../public/favicon.ico'

一些谷歌搜索,我不知道解决方案,这是从快递和应该工作的演示应用程序,我已经厌倦了上周,它是工作。

I did some googling and i am not sure the solution, this is the demo app from express and should work, i have tired this last week and it was working.

任何见解将请注意

推荐答案

将此行添加到app.js的初始化部分:

Append this line into the initialization section of your app.js:

app.use(favicon(__dirname + '/public/favicon.ico'));

我假设app.js在项目目录中,而favicon文件位于public / favicon.ico也相对于项目文件夹。

I assume that app.js is in the project directory and favicon file is at public/favicon.ico also relative to the project folder.

这篇关于错误:ENOENT,打开favicon.ico的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆