ioBroker / ioBroker.sql

Store history data in SQL Database: MySQL, PostgreSQL or SQLite
MIT License
45 stars 25 forks source link

Error: Cannot find module 'mssql' #346

Closed Naetschie closed 8 months ago

Naetschie commented 8 months ago

Hey I used this adapter for a few weeks with mariadb and had no Issues. I wanted to switch to MSSQL because I do use it on a daily basis and wanted to some reports and stuff on it.

When i use db-Type mssql and i start the adapter i get this error massage in the log:

Error: Cannot find module 'mssql'Require stack:- /opt/iobroker/node_modules/iobroker.sql/lib/mssql-client.js- /opt/iobroker/node_modules/iobroker.sql/main.js at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1028:15) at Function.Module._load (node:internal/modules/cjs/loader:873:27) at Module.require (node:internal/modules/cjs/loader:1100:19) at require (node:internal/modules/cjs/helpers:119:18) at Object. (/opt/iobroker/node_modules/iobroker.sql/lib/mssql-client.js:6:31) at Object. (/opt/iobroker/node_modules/iobroker.sql/lib/mssql-client.js:61:4) at Module._compile (node:internal/modules/cjs/loader:1198:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10) at Module.load (node:internal/modules/cjs/loader:1076:32) at Function.Module._load (node:internal/modules/cjs/loader:911:12)

Exception-Code: MODULE_NOT_FOUND: Cannot find module 'mssql'Require stack:- /opt/iobroker/node_modules/iobroker.sql/lib/mssql-client.js- /opt/iobroker/node_modules/iobroker.sql/main.js

what i already did is to update/install the mssql bib on the raspberry with npm install mssql

The error persists. Someone has any idea ? Thanks in advance.

Apollon77 commented 8 months ago

Try to delete and reinstall the adapter (not just instance, wholeadapter)

Naetschie commented 8 months ago

already tried that but did it again. the result is the same. what JS and Node is requiered for the MSSQL implementation? I Currently use 5.0.17 JS and v16.20.2 Node. The error states that it need a differnt Version grafik

Apollon77 commented 8 months ago

Then please remove adapter and install again manually by using "iob add sql --debug" to maybe see compile errors when building. because in fact it seems that a binary module is not installed correctly for the mssql support

Naetschie commented 8 months ago

Hey, thanks for your continued help. Here is a screenshot, I cant see anything special, just a few warnings. :(

grafik

Apollon77 commented 8 months ago

hm ...me nether ... you could try to uninstall adapter again and check if you have node_modules/mssql ... if this is somehow still there ... delete it ... and then install again with debug ...

ALternatively try cd node_modules/mssql nd run "npm rebuild" there ... if this changes nothing try "npm install" in this dir.

Naetschie commented 8 months ago

sorry for my late response but i had not time to work on this problem until now.

What i found, look at the path that the adapter is checking for the files. I copied the folders form node_modules to the /iobroker/node_modules/ grafik

After that, the adapter is starting but now it seams i get dependencies errors. is there some kind of configuration wrong in my iobroker installation?

Apollon77 commented 8 months ago

But you read the screenshot and see that it is /opt/iobroker/node_modules/ ... thats the default location

Apollon77 commented 8 months ago

Did you do what I proposed last?

Naetschie commented 8 months ago

yea you are totaly right and i was completly on the wrong track :D I now followed your steps. The "npm install" in the folder fixed the problem! Thank you very much.

Best Regards,