outmoded / tv

Interactive debug console
Other
186 stars 41 forks source link

server.views undefined is not a function #118

Closed jan-swiecki closed 7 years ago

jan-swiecki commented 9 years ago

When I register plugin with server.register(Tv, callback) I get this

C:\projects\test\node_modules\Tv\lib\index.js:31
    server.views({
           ^
TypeError: undefined is not a function
    at Object.exports.register (C:\projects\test\node_modules\Tv\lib\index.js:31:12)
    at Items.serial.self.root._registring (C:\projects\test\node_modules\hapi\lib\plugin.js:255:14)
    at iterate (C:\projects\test\node_modules\hapi\node_modules\items\lib\index.js:35:13)
    at Object.exports.serial (C:\projects\test\node_modules\hapi\node_modules\items\lib\index.js:38:9)
    at internals.Plugin.register (C:\projects\test\node_modules\hapi\lib\plugin.js:234:11)
    at HapiApi.attachPlugins (C:\projects\test\modules\api\HapiApi.js:59:19)
    at HapiApi.init (C:\projects\test\modules\api\HapiApi.js:43:10)
    at C:\projects\test\app.js:31:11
    at Function.Injector.applyMap (C:\dev\projects\node-autowire\lib\Injector.js:191:20)
    at Function.func.(anonymous function) (C:\dev\projects\node-autowire\lib\Functionize.js:59:28)
    at Function.Injector.exec (C:\dev\projects\node-autowire\lib\Injector.js:150:15)
    at Function.func.(anonymous function) (C:\dev\projects\node-autowire\lib\Functionize.js:59:28)
    at Function.<anonymous> (C:\dev\projects\node-autowire\index.js:131:21)
    at f (C:\dev\projects\node-autowire\lib\Functionize.js:92:15)
    at Object.<anonymous> (C:\projects\test\app.js:26:1)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

Probable cause: hapijs/hapi#2706 i.e. hapi 9 compatibility problem.

It worked after registering inert and vision plugin manually i.e. server.register([require('inert'), require('vision'), require('tv'), function(err) {...}); // in that order

osukaa commented 9 years ago

Yeah, it's the same thing. I'm working on that here https://github.com/hapijs/tv/pull/117

jamesdixon commented 9 years ago

I'm running into the same error, but it does not work when registering inert and vision. However, I'm using Glue, so maybe that's the reason why.

phattranky commented 8 years ago

I updated Hapi to 11.x and get the same problem in my test code (i use composer manifest for develop code). Then I move the server.views to the register callback, the issue is solved :). Hope it help Show my code (it a test case code, but in the develop code, the register, and config server view is same)

capture

Mari01032015 commented 7 years ago

Hi, I'm new to hapi. Facing same issue "server.views undefined is not a function" Anyone knows how to fix this issue?

osukaa commented 7 years ago

Yo need to install vision/visionary El El mié, 14 de dic. de 2016 a las 04:44, Mari01032015 < notifications@github.com> escribió:

Hi, I'm new to hapi. Facing same issue "server.views undefined is not a function" Anyone knows how to fix this issue?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hapijs/tv/issues/118#issuecomment-267002538, or mute the thread https://github.com/notifications/unsubscribe-auth/AAi5f7GH_kRcJGWMlT2zzOrwuiLtwfeMks5rH8iTgaJpZM4Fz16Z .

-- Sent from Inbox,

Oscar