Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'reduce' of undefined #9

Open
stevepmitchell opened this issue Nov 29, 2016 · 7 comments
Open

TypeError: Cannot read property 'reduce' of undefined #9

stevepmitchell opened this issue Nov 29, 2016 · 7 comments

Comments

@stevepmitchell
Copy link

Setting up the various modules for @sbender9 page at https://github.com/sbender9/wilhelmsk-node-server-setup, and after enabling the modules and setting the correct IDs, SignalK exited with the error below. Continuing to try to restart results in the same error.

I'm not sure where these settings are stored so I can zero them out and reproduce...

`/home/pi/signalk-server-node/node_modules/signalk-zones/index.js:81
unsubscribes = options.zones.reduce((acc, {
^

TypeError: Cannot read property 'reduce' of undefined
at Object.plugin.start (/home/pi/signalk-server-node/node_modules/signalk-zones/index.js:81:33)
at /home/pi/signalk-server-node/lib/interfaces/plugins.js:139:16
at FSReqWrap.oncomplete (fs.js:123:15)
pi@grace:~/signalk-server-node$ bin/signalk-server
No settings/defaults.json available
/home/pi/signalk-server-node/node_modules/signalk-zones/index.js:81
unsubscribes = options.zones.reduce((acc, {
^

TypeError: Cannot read property 'reduce' of undefined
at Object.plugin.start (/home/pi/signalk-server-node/node_modules/signalk-zones/index.js:81:33)
at registerPlugin (/home/pi/signalk-server-node/lib/interfaces/plugins.js:115:12)
at fs.readdirSync.filter.forEach.e (/home/pi/signalk-server-node/lib/interfaces/plugins.js:93:7)
at Array.forEach (native)
at startPlugins (/home/pi/signalk-server-node/lib/interfaces/plugins.js:85:68)
at Object.start (/home/pi/signalk-server-node/lib/interfaces/plugins.js:26:7)
at /home/pi/signalk-server-node/lib/index.js:170:30
at /home/pi/signalk-server-node/node_modules/lodash/index.js:3073:15
at Function.forIn (/home/pi/signalk-server-node/node_modules/lodash/index.js:3362:16)
at startInterfaces (/home/pi/signalk-server-node/lib/index.js:162:5)`

@tkurki
Copy link
Member

tkurki commented Nov 29, 2016

Are you sure you have the latest version? This was fixed in c19a884 and master version no longer has a line like unsubscribes = options.zones.reduce((acc, { per your error message.

@stevepmitchell
Copy link
Author

stevepmitchell commented Nov 29, 2016 via email

@tkurki
Copy link
Member

tkurki commented Nov 29, 2016

It is merged, see https://github.com/SignalK/signalk-zones/blob/master/index.js#L96.

A fresh install of SK server does have that change:

$ grep reduce node_modules/signalk-zones/index.js 
    unsubscribes = (options.zones || []).reduce((acc, {

Scott's instructions don't go into detail so I don't know what exactly you did, but I think npm install in the server's root direction should bring you the update.

@stevepmitchell
Copy link
Author

stevepmitchell commented Nov 29, 2016 via email

@tkurki
Copy link
Member

tkurki commented Nov 29, 2016

Just delete node_modules/signalk-zones/ and reinstall it with npm install signalk/signalk-zones, that should do the trick.

It is really just one file, the one I linked and pointed above, so if all else fails you can install it manually.

@stevepmitchell
Copy link
Author

stevepmitchell commented Nov 29, 2016 via email

@stevepmitchell
Copy link
Author

stevepmitchell commented Nov 29, 2016 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants