WebThingsIO / onvif-adapter

ONVIF Profile S video camera adapter
Mozilla Public License 2.0
10 stars 6 forks source link

Error Starting Addon #9

Closed mowi22 closed 5 years ago

mowi22 commented 5 years ago

I'm getting the following error when I try to use the adapter.

 ERROR  : onvif: { Error: Cannot find module 'gateway-addon'
 at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)

Any idea of how to fix this?

mrstegeman commented 5 years ago
  1. Is this a gateway you built yourself, or our 0.7 image for the Raspberry Pi?
  2. Did you install this add-on through the UI, or something else?
mowi22 commented 5 years ago

I built it myself on a rpi. and I installed the addon via the UI.

mrstegeman commented 5 years ago

The gateway-addon module is a dependency of the gateway and injected into the NODE_PATH before starting the add-on, so just using npm install inside the gateway should be enough to get you that dependency.

Are you able to install and run any other add-ons?

mowi22 commented 5 years ago

I have run the npm install in the gateway folder and there are 0 vulnerabilities. Tplink and Wemo Adaptors are working just fine. But Im seeing the error on other addons like netamo. I'm unsure as of the cause.

mrstegeman commented 5 years ago

TP-Link and Wemo are both written in Python, so they have a different dependency. Can you try installing the Virtual Things add-on?

mowi22 commented 5 years ago

Sorry for the delay, I just tried the Virtual things add-on and it's giving me that same error. Is there a way I can make sure the dependency is added via the package manager, or do I need to wipe and reinstall to fix this? This is my current list.

"dependencies": {
    "ajv": "^6.9.1",
    "archiver": "^3.0.0",
    "asn1.js": "^5.0.1",
    "bcryptjs": "^2.4.3",
    "body-parser": "^1.18.3",
    "callsites": "^3.0.0",
    "compression": "^1.7.3",
    "config": "^3.0.1",
    "core-js": "^2.6.5",
    "dnssd": "^0.4.1",
    "express": "^4.16.4",
    "express-fileupload": "^1.0.0",
    "express-handlebars": "^3.0.0",
    "express-promise-router": "^3.0.3",
    "express-ws": "^4.0.0",
    "gateway-addon": "git+https://github.com/mozilla-iot/gateway-addon-node.git",
    "greenlock": "^2.6.7",
    "handlebars": "^4.1.0",
    "http-proxy": "^1.17.0",
    "ip-regex": "^4.0.0",
    "jsonwebtoken": "^8.5.0",
    "le-challenge-dns": "^2.3.2",
    "le-challenge-fs": "^2.0.8",
    "mkdirp": "^0.5.1",
    "nanomsg": "^4.0.2",
    "ncp": "^2.0.0",
    "nocache": "^2.0.0",
    "node-fetch": "^2.3.0",
    "node-getopt": "^0.3.2",
    "promisepipe": "^3.0.0",
    "rimraf": "^2.6.3",
    "source-map-support": "^0.5.10",
    "sqlite3": "^4.0.6",
    "string-format": "^2.0.0",
    "tar": "^4.4.8",
    "tmp": "^0.0.33",
    "uuid": "^3.3.2",
    "web-push": "^3.3.3",
    "winston": "^3.2.1",
    "winston-daily-rotate-file": "^3.7.0",
    "ws": "^6.1.4"
  },
mrstegeman commented 5 years ago

gateway-addon-node is the one you seem to be missing, but I don't believe the gateway would start up at all if that were missing.

@hobinjk Any idea what could be happening here?

mrstegeman commented 5 years ago

@mowi22 Do the following directories exist for you, and are they populated?

mowi22 commented 5 years ago

Yes, this is in the folder index.js lib LICENSE package.json README.md and inside of lib is action.js adapter.js constants.js database.js deferred.js device.js event.js property.js utils.js

mrstegeman commented 5 years ago

Closing in favor of mozilla-iot/gateway#1799