我正在本地计算机上运行nodejs应用程序而且我得到了这些 错误日志中的错误:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'start' ]
2 info using npm@3.5.2
3 info using node@v4.2.6
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle visualapp@1.0.0~prestart: visualapp@1.0.0
6 silly lifecycle visualapp@1.0.0~prestart: no script for prestart, continuing
7 info lifecycle visualapp@1.0.0~start: visualapp@1.0.0
8 verbose lifecycle visualapp@1.0.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle visualapp@1.0.0~start: PATH: /usr/share/npm/bin/node-gyp-bin:/home/martiner/www/visualizationApp/NODEJS/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/martiner/.local/bin:/home/martiner/.local/bin
10 verbose lifecycle visualapp@1.0.0~start: CWD: /home/martiner/www/visualizationApp/NODEJS
11 silly lifecycle visualapp@1.0.0~start: Args: [ '-c', 'nodejs hello.js' ]
12 silly lifecycle visualapp@1.0.0~start: Returned: code: 1 signal: null
13 info lifecycle visualapp@1.0.0~start: Failed to exec start script
14 verbose stack Error: visualapp@1.0.0 start: `nodejs hello.js`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/usr/share/npm/lib/utils/lifecycle.js:232:16)
14 verbose stack at emitTwo (events.js:87:13)
14 verbose stack at EventEmitter.emit (events.js:172:7)
14 verbose stack at ChildProcess.<anonymous> (/usr/share/npm/lib/utils/spawn.js:24:14)
14 verbose stack at emitTwo (events.js:87:13)
14 verbose stack at ChildProcess.emit (events.js:172:7)
14 verbose stack at maybeClose (internal/child_process.js:821:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
15 verbose pkgid visualapp@1.0.0
16 verbose cwd /home/martiner/www/visualizationApp/NODEJS
17 error Linux 4.4.0-75-generic
18 error argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
19 error node v4.2.6
20 error npm v3.5.2
21 error code ELIFECYCLE
22 error visualapp@1.0.0 start: `nodejs hello.js`
22 error Exit status 1
23 error Failed at the visualapp@1.0.0 start script 'nodejs hello.js'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the visualapp package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error nodejs hello.js
23 error You can get information on how to open an issue for this project with:
23 error npm bugs visualapp
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls visualapp
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
我在控制台中收到以下错误:
events.js:141
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at exports._errnoException (util.js:870:11)
at TLSWrap.onread (net.js:544:26)
我已多次查看代码,无法确定问题的来源。 有人可以帮我解决这个问题吗?
我有几个fs.readFile
和两次使用nodemailer。以下是它的片段:
function sendingMail(p1, user_email, p2, p3, err){
var first_line_here, number_lines_count;
fs.readFile(__dirname +'/' + '/textfile.txt', 'utf8', function (err, data) {
if (err) {
throw err;
}
first_line_here = data.split('\n').shift();
var number_lines_count = first_line_here.substr(first_line_here.indexOf(":") + 1);
var smtpTransport = nodemailer.createTransport("SMTP", {
host: config.smtp,
secureConnection: false,
port: config.smtpPort,
auth: {
user: config.smtpU,
pass: config.smtpP
}
});
var mailMessage = '<p>content'</p>';
var mailOptions = {
from: config.from,
to: user_email,
subject: "Subject Line",
html: mailMessage
}
if (err){
}
smtpTransport.sendMail(mailOptions, function(error, response){
if(error){
console.log(error);
}else{
console.log("Message sent: " + response.message);
}
});
});
}