virtualzone / landroid-bridge

Bridge for connecting the Worx Landroid S Lawn Mower to home automation systems like OpenHAB or FHEM.
GNU General Public License v3.0
65 stars 48 forks source link

Unexpected token N in JSON at position 0 #56

Open sracing opened 5 years ago

sracing commented 5 years ago

I know the general understanding is that the latest pull resolves the "Unexpected token N in JSON at position 0" failure caused by the new API v2, but it did not work for me and a couple of other users that seem to have still problems.

I first tried a clean reinstall, but similar to other users I had build errors when installing node.js.

Let me tell you how I was able to fix it for my Raspberry by manual modification of the latest commit f45a42e (19 days ago):

1) Make sure you have the latest version of weweave/landroid-bridge (git pull) 2) In the src/LandroidS.ts file, make sure you have import * as LandroidCloud from "iobroker.landroid-s/lib/mqttCloud"; (as noted in the pull request.) 3) Edit package.json file from: "iobroker.landroid-s": "^2.5.4", to "iobroker.landroid-s": "^2.5.5", 4) Run sudo npm run grunt to recompile

5) However, that still does not pull the latest version 2.5.5 of the iobroker.landroid-s adapter, so you need to manually replace all the files from your local landroid-bridge\node_modules\iobroker.landroid-s directory with the files from https://github.com/MeisterTR/ioBroker.landroid-s.

6) Restart your landroid-bridge.service (e.g. node dist/server.js)

That Landroid-Bridge provides a solid MQTT bridge to anybody in smarthome applications, maybe someone can check on the needed modifications to ensure it is installe properly (at least the package.json seem to need a change to reference to dependency 2.5.5.)

RolandRosenfeld commented 5 years ago

I'm not very deep in the node.js universe, but as far as I can see, a simple npm update should do the trick and update all your dependencies. Maybe a npm run grunt after this may be a good idea to rebuild all.

sracing commented 5 years ago

No. I´m on node.js v8 as recommended in the readme.md and did the npm run grunt any multiple times.

Not a expert as well, but see topic #3 in my manual fix - the package.json file shows a dependency to a outdated version of https://github.com/MeisterTR/ioBroker.landroid-s.

RolandRosenfeld commented 5 years ago

But npm update updates all packages to the most recent version. On my system (with node.js 10) this also upgrades iobroker.landroid-s from 2.5.4 to 2.5.5.

berland commented 5 years ago

Thanks, the tips herein solved that problem for me.

olskar commented 5 years ago

Strange, I have version 2.5.5 in my installation (confirmed with npm -l) and "import * as LandroidCloud from "iobroker.landroid-s/lib/mqttCloud";" in src. But still get this error..

It worked for a while but stopped working a few days ago.

https://github.com/weweave/landroid-bridge/issues/46