Node js error require modules

452 Views Asked by At

I created an API including using of hummus.js. After testing it local, I uploaded my new API Build on my Server (Ubuntu Root + Plesk Onyx) and npm install my package.json (with Plesk => Output: Installation complete Status: Success). But my new Build doesn't work. After debugging my Code I detect the error. My API get an Internal Error after require one module (Tested this with that Code)

try {
 var hummus = require('hummus');
 var fillClass = require('../classes/fillform').fillForm;
    }
    catch (e) {
    res.send("ERROR HUMMUS")
    }

Run this Code I get = ERROR HUMMUS

I thought that the hummus path doesn't exist but with:

 try {
      res.send(require.resolve("hummus")).end();
  } catch(e) {
      res.send("not found").end();
      process.exit(e.code);
  }

I get the path to the module (hummus). Although all file in this folder exists.

(Other modules like async, fs etc works well)

What I do wrong? What should I do?

Greetings

edit Package.json {"name": "XXX-API", "version": "1.0.9", "main": "server.js", "dependencies": { "archiver": "^2.0.0", "array-sum": "^1.0.0", "async": "^2.5.0", "big-integer": "^1.6.24", "body-parser": "^1.17.2", "child_process": "^1.0.2", "cors": "^2.8.3", "curl": "^0.1.4", "express": "^4.15.3", "file-encryptor": "^0.1.1", "fs": "0.0.1-security", "ftp": "^0.3.10", "ftp-client": "^0.2.2", "ftps": "^1.1.0", "german-tax-id-validator": "^1.0.3", "https": "^1.0.0", "hummus": "^1.0.80", "ibantools": "^1.3.0", "jsftp": "^2.0.0", "leading-zeros": "^1.0.1", "lodash": "^4.17.4", "mysql": "^2.13.0", "node-datetime": "^2.0.0", "node-pdffiller": "0.0.7", "node-uuid": "^1.4.8", "node-zip": "^1.1.1", "nodemailer": "^4.0.1", "pad-right": "^0.2.2", "pdfkit": "^0.8.3", "phantomjs": "^2.1.7", "pug": "^2.0.0-rc.2", "request-promise": "^4.2.1", "requestify": "^0.2.5", "shortid": "^2.2.8", "slack-node": "^0.1.8", "uid": "0.0.2", "xmlbuilder": "^9.0.4" } }

1

There are 1 best solutions below

0
On

Pls write the error to log.

... catch (err){
   logger.debug(err.stack)
}

No better way than error stack.