soef / ioBroker.tr-064

tr-64 Adapter for ioBroker
MIT License
21 stars 9 forks source link

issue with js-controller 1.4.0 #70

Open xmace opened 6 years ago

xmace commented 6 years ago

The adapter worked well since I updated the js-controller to latest version 1.3.0.

`

host.iobrokerVM 2018-03-13 10:15:29.054 info Do not restart adapter system.adapter.tr-064.0 because disabled or deleted
host.iobrokerVM 2018-03-13 10:15:29.054 error instance system.adapter.tr-064.0 terminated with code 1 ()
Caught 2018-03-13 10:15:29.054 error by controller[0]: at bootstrap_node.js:608:3
Caught 2018-03-13 10:15:29.054 error by controller[0]: at startup (bootstrap_node.js:187:16)
Caught 2018-03-13 10:15:29.054 error by controller[0]: at Function.Module.runMain (module.js:684:10)
Caught 2018-03-13 10:15:29.054 error by controller[0]: at Function.Module._load (module.js:491:3)
Caught 2018-03-13 10:15:29.054 error by controller[0]: at tryModuleLoad (module.js:499:12)
Caught 2018-03-13 10:15:29.054 error by controller[0]: at Module.load (module.js:556:32)
Caught 2018-03-13 10:15:29.054 error by controller[0]: at Object.Module._extensions..js (module.js:654:10)
Caught 2018-03-13 10:15:29.053 error by controller[0]: at Module._compile (module.js:643:30)
Caught 2018-03-13 10:15:29.053 error by controller[0]: at Object. (/opt/iobroker/node_modules/iobroker.tr-064/tr-064.js:16:20)
Caught 2018-03-13 10:15:29.053 error by controller[0]: at Object.exports.Adapter (/opt/iobroker/node_modules/soef/soef.js:1383:23)
Caught 2018-03-13 10:15:29.053 error by controller[0]: TypeError: fns.adapter is not a function
Caught 2018-03-13 10:15:29.053 error by controller[0]: ^
Caught 2018-03-13 10:15:29.053 error by controller[0]: fns.adapter = fns.adapter(options);
Caught 2018-03-13 10:15:29.052 error by controller[0]: /opt/iobroker/node_modules/soef/soef.js:1383
host.iobrokerVM 2018-03-13 10:15:22.124 info object change system.adapter.tr-064.0

`

Soulguard commented 6 years ago

^^same here^^ Adapter worked well since update js-controller to 1.3.0

xmace commented 6 years ago

push

sm79 commented 6 years ago

I had the same issue last night - found out the following:

In

/opt/iobroker/node_modules/soef/soef.js:1383

the function call fns.adapter(options) doesn't work, because at this point fns.adapter was not created.

The reason can be found some lines above:

 if (!fns.adapter) { 
     var _modules = [ process.mainModule.filename.replace(/lightify.js$/, ''+ 'lib/utils',
         __dirname + '/../iobroker.admin/lib/utils', 
         __dirname + '/../../lib/utils' 
     ]

With js-controller 1.3.0 (at my system), the directory /../iobroker.admin was removed. Also the other directories were not existing. So fns.adapter could not be created due to missing utils.js.

My Workaround: Find a suitable utils.js in any directory within "/opt/iobroker/node_modules/" I found one in directory "iobroker.kodi" - so adding the following line worked for me:

__dirname + '/../iobroker.kodi/lib/utils',

Now the section looks like:

 if (!fns.adapter) { 
     var _modules = [ process.mainModule.filename.replace(/lightify.js$/, ''+ 'lib/utils',
         __dirname + '/../iobroker.admin/lib/utils', 
         __dirname + '/../iobroker.kodi/lib/utils',
         __dirname + '/../../lib/utils' 
     ]

I know this is really dirty, but it was late last night!

Finding: Writing this text I found that with js-controller 1.3.0, the directory iobroker.admin was (by accident?) moved to "/opt/iobroker/node_modules/iobroker.js-controller/node_modules/". So the utils.js is now here:

/opt/iobroker/node_modules/iobroker.js-controller/node_modules/iobroker.admin/lib/utils.js

I don't know (yet) if this is intended or not @GermanBluefox. If so, the following line could probably be added to soef.js:

         __dirname + '/../iobroker.js-controller/node_modules/iobroker.admin/lib/utils',
xmace commented 6 years ago

and again

host.iobrokerVM 2018-04-04 23:50:04.007 error instance system.adapter.tr-064.0 terminated with code 1 ()
Caught 2018-04-04 23:50:04.007 error by controller[0]: at bootstrap_node.js:608:3
Caught 2018-04-04 23:50:04.007 error by controller[0]: at startup (bootstrap_node.js:187:16)
Caught 2018-04-04 23:50:04.006 error by controller[0]: at Function.Module.runMain (module.js:684:10)
Caught 2018-04-04 23:50:04.006 error by controller[0]: at Function.Module._load (module.js:491:3)
Caught 2018-04-04 23:50:04.006 error by controller[0]: at tryModuleLoad (module.js:499:12)
Caught 2018-04-04 23:50:04.006 error by controller[0]: at Module.load (module.js:556:32)
Caught 2018-04-04 23:50:04.006 error by controller[0]: at Object.Module._extensions..js (module.js:654:10)
Caught 2018-04-04 23:50:04.006 error by controller[0]: at Module._compile (module.js:643:30)
Caught 2018-04-04 23:50:04.006 error by controller[0]: at Object. (/opt/iobroker/node_modules/iobroker.tr-064/tr-064.js:16:20)
Caught 2018-04-04 23:50:04.006 error by controller[0]: at Object.exports.Adapter (/opt/iobroker/node_modules/soef/soef.js:1383:23)
Caught 2018-04-04 23:50:04.006 error by controller[0]: TypeError: fns.adapter is not a function
Caught 2018-04-04 23:50:04.005 error by controller[0]: ^
Caught 2018-04-04 23:50:04.005 error by controller[0]: fns.adapter = fns.adapter(options);
Caught 2018-04-04 23:50:04.005 error by controller[0]: /opt/iobroker/node_modules/soef/soef.js:1383
drecksgekritzel commented 6 years ago

I have the same problem since i have updated my js controller...

R-Guhr commented 6 years ago

I have the same problem.

GreenRa commented 6 years ago

Hi, I have the same Problem since I updated my js-controller from version 1.2.3 to version 1.4.2 today. If there any workaround available yet?

Supplement: The Workaround described by sm79 some comments above worked for me!

jogibear9988 commented 5 years ago

This issue was moved to iobroker-community-adapters/ioBroker.tr-064-community#21