我創建了一個API,包括使用hummus.js。在本地測試之後,我在我的服務器上(Ubuntu Root + Plesk Onyx)上傳了我的新API Build,並且安裝了我的package.json(Plesk => Output:Installation complete Status:Success)。但是我的新版本不起作用。在調試我的代碼後,我檢測到錯誤。我的API得到一個內部錯誤需要一個模塊(與代碼測試這個)節點js錯誤需求模塊
try {
var hummus = require('hummus');
var fillClass = require('../classes/fillform').fillForm;
}
catch (e) {
res.send("ERROR HUMMUS")
}
運行這段代碼,我得到= ERROR豆沙
我認爲豆沙路徑不存在,但用後:
try {
res.send(require.resolve("hummus")).end();
} catch(e) {
res.send("not found").end();
process.exit(e.code);
}
我得到模塊(鷹嘴豆泥)的路徑。儘管此文件夾中的所有文件都存在。
(其它模塊,如異步,FS等效果很好)
我做什麼了?我該怎麼辦?
問候
編輯的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" } }
你能告訴我們錯誤對象'e'過嗎? – lumio
你可以發佈你的package.json文件的內容嗎? – schu34
對象e爲空=> {}。編輯字段中的Package.json – Ckappo