Cannot read property 'createStream' of undefined

Viewed 199

[Type err in the picture][1] [1]: https://i.stack.imgur.com/pelro.png

TypeError: Cannot read property 'createStream' of undefined
> this is my code: 
const rfsStream = rfs.createStream('server.log',  size: '10M',
interval: '1d', 
path: path.join(__dirname, 'public', 'logs'), });

app.use(morgan('combined', { stream: rfsStream }));
1 Answers

I just had this problem and solved it as follows:

import { createStream } from 'rotating-file-stream';

...

const rfsStream = createStream('server.log', /* etc. */);
Related