egg: TypeError: Cannot read property 'use' of undefined

  • Node Version: 6.10.0
  • Egg Version: 1.0.0-rc.1
  • Plugin Name:
  • Plugin Version:
  • Platform: Linux

app.js


module.exports = app => {
 	app.view.use('handlebars', require('./lib/view'));
};

执行yarn test

  1) test/egg-view-handlebars.test.js render "before all" hook:
     TypeError: Cannot read property 'use' of undefined
      at module.exports.app (app.js:8:11)
      at AppWorkerLoader.loadFile (node_modules/egg-core/lib/loader/egg_loader.js:217:34)
      at getLoadUnits.forEach.unit (node_modules/egg-core/lib/loader/mixin/custom.js:25:29)
      at Array.forEach (native)
      at AppWorkerLoader.loadCustomApp (node_modules/egg-core/lib/loader/mixin/custom.js:25:8)
      at AppWorkerLoader.load (node_modules/egg/lib/loader/app_worker_loader.js:33:10)
      at MeesengerApplication.Application (node_modules/egg/lib/application.js:34:19)
      at MeesengerApplication (node_modules/egg-mock/lib/app.js:221:7)
      at MockApplication.[init] (node_modules/egg-mock/lib/app.js:67:29)
      at undefined.next (native)
      at onFulfilled (node_modules/co/index.js:65:19)
      at process._tickCallback (internal/process/next_tick.js:103:7)

怎么解决这个问题

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (16 by maintainers)

Most upvoted comments

english please