我在安装node.js和mongodb项目时遇到问题。 我已经安装了所有节点模块和mongodb。 运行monogodb服务器后,我无法运行节点服务器。 而且出现以下错误。
Sajals-Air:library-mgmt isajal07$ node index
library_system listening on port 3000
{
"res": {
"statusCode": 302
},
"req": {
"url": "/",
"headers": {
"host": "localhost:3000",
"connection": "keep-alive",
"upgrade-insecure-requests": "1",
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36",
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
"accept-encoding": "gzip, deflate, br",
"accept-language": "en-GB,en-US;q=0.9,en;q=0.8",
"cookie": "librarySys=s%3AXGrItDjCvFlXbYPemPtGfpZXvvXQAvx8.SSZDbc9Vjx2byRcpeOoRDvxz4PZ1lUeFRmyEmw6XeNc"
},
"method": "GET",
"httpVersion": "1.1",
"originalUrl": "/",
"query": {}
},
"responseTime": 4,
"level": "info",
"message": "HTTP GET /"
}
events.js:174
throw er; // Unhandled 'error' event
^
Error: ENOENT: no such file or directory, open 'logs/success.log'
Emitted 'error' event at:
at WriteStream.<anonymous> (/Users/isajal07/Desktop/library-mgmt/node_modules/winston/lib/winston/transports/file.js:491:16)
at WriteStream.emit (events.js:189:13)
at lazyFs.open (internal/fs/streams.js:272:12)
at FSReqWrap.args [as oncomplete] (fs.js:140:20)