节点文件编译错误显示?

时间:2015-09-17 13:27:26

标签: node.js sails.js

每次运行我的代码 node mail2.js 时都会出现此错误 * 我已经安装了所有模块,但仍然收到此错误

 throw err;
      ^
Error: Cannot find module '/Users/anuppanwar/Downloads/project/wetty/mail2.js'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3

这是我的代码

var ses = require('node-ses')
, client = ses.createClient({ key: 'my_key', secret:      'my_secreat_key', amazone: 'https://ec3-52-11-150-17.us-west-2.compute.amazonaws.com' });

// Give SES the details and let it construct the message for you.  
client.sendEmail({
to: 'anup.panwar36@gmail.com'
, from: 'anup.panwar36@gmail.com'
 , cc: 'theWickedWitch@nerds.net'
 , bcc: ['canAlsoBe@nArray.com', 'forrealz@.org']
 , subject: 'greetings'
 , message: 'your goes here'
 , altText: 'plain text'
  }, function (err, data, res) {
// ... i
   if(err) {
    throw err
  }
 if(data){
  console.log("data"+data);
}



});

每次我运行我的代码时都会得到相同的抛出错误,不知道为什么?

1 个答案:

答案 0 :(得分:0)

您尚未导入mail2。您必须导入它。

var mail2 = require('mail2');