root@------:~# cd /home/bot root@------:/home/bot# node site.js
/home/bot/node_modules/log4js/lib/configuration.js:43 throw new Error( Problem with log4js configuration: (${util.inspect(this.candidate, { depth: 5 })})
+ ^
Error: Problem with log4js configuration: ({ appenders: [ { type: 'console' }, { type: 'file', filename: 'logs/site.log' } ] }) - must have a property "appenders" of type object. at tests.forEach (/home/bot/node_modules/log4js/lib/configuration.js:43:15) at Array.forEach (native) at Configuration.throwExceptionIf (/home/bot/node_modules/log4js/lib/configuration.js:41:11) at new Configuration (/home/bot/node_modules/log4js/lib/configuration.js:203:10) at Object.configure (/home/bot/node_modules/log4js/lib/log4js.js:205:12) at Object. (/home/bot/site.js:12:8) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12)
i use command npm install log4j --save
root@------:/home/bot# npm install log4j --save
npm ERR! Linux 3.2.0-4-amd64 npm ERR! argv "/root/.nave/installed/6.11.1/bin/node" "/root/.nave/installed/6.11.1/bin/npm" "install" "log4j" "--save" npm ERR! node v6.11.1 npm ERR! npm v3.10.10 npm ERR! code E404
npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/log4j npm ERR! 404 npm ERR! 404 'log4j' is not in the npm registry. npm ERR! 404 You should bug the author to publish it (or use the name yourself!) npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! Please include the following file with any support request: npm ERR! /home/bot/npm-debug.log
I had the same problem as u with the same script xD. I found a solution!!!!!!!!!!!!! U need to change thelog4js.configure in your site.js to this
log4js.configure({
appenders: {
out: { type: 'console' },
task: { type: 'file', filename: 'logs/site.log' }
},
categories: {
default: { appenders: [ 'out' ], level: 'info' },
task: { appenders: [ 'task' ], level: 'info' }
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.