janpieterz / koajs-static-folder

Middleware for KoaJS to serve folder as static files.
MIT License
10 stars 2 forks source link

App started crashing #8

Open abdullah353 opened 7 years ago

abdullah353 commented 7 years ago

After adding the asset package as following.

const serve = require('koa-static-folder')
const app = new Koa()
app.use(serve('./public'))

I have started receiving the following error on page refresh.

internal/streams/destroy.js:12
      cb(err);
      ^

TypeError: cb is not a function
    at ReadStream.destroy (internal/streams/destroy.js:12:7)
    at listener (/Users/XAM/liimex/portfolio/node_modules/on-finished/index.js:169:15)
    at onFinish (/Users/XAM/liimex/portfolio/node_modules/on-finished/index.js:100:5)
    at callback (/Users/XAM/liimex/portfolio/node_modules/ee-first/index.js:55:10)
    at ServerResponse.onevent (/Users/XAM/liimex/portfolio/node_modules/ee-first/index.js:93:5)
    at emitNone (events.js:110:20)
    at ServerResponse.emit (events.js:207:7)
    at onFinish (_http_outgoing.js:733:10)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)

Also their is this warning when i start the server.

koa deprecated Support for generators will be removed in v3. See the documentation for examples of how to convert old middleware https://github.com/koajs/koa/blob/master/docs/migration.md
janpieterz commented 7 years ago

Hi @mabdullah353

Are you using this with koa v2? If so, we're indeed not setup to handle V2, and I haven't worked a lot with node/koa lately.

abdullah353 commented 7 years ago

yes i am using "koa": "2.3.0".

anwarkh commented 6 years ago

Hello, any new news about this issue ? I have the same problem.

janpieterz commented 6 years ago

@anwarkh no news! I'm not using koa/node anymore so difficult to get it going again. I'm open for a pull request though.