最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to downgrade this node.js module to specific version and prevent automatic upgrade later? - Stack Overflow

programmeradmin3浏览0评论

I am using node.js Nodemailer module and encountered the following error;

[Error: Unsupported configuration, downgrade Nodemailer to v0.7.1 or see the migration guide ]

I looked at my package.json and realize that it is "nodemailer": "^1.8.0", version.

How do I downgrade to v0.7.1 and prevent automatic upgrade later when I run npm update?

I am using node.js Nodemailer module and encountered the following error;

[Error: Unsupported configuration, downgrade Nodemailer to v0.7.1 or see the migration guide https://github.com/andris9/Nodemailer#migration-guide]

I looked at my package.json and realize that it is "nodemailer": "^1.8.0", version.

How do I downgrade to v0.7.1 and prevent automatic upgrade later when I run npm update?

Share Improve this question edited Nov 8, 2015 at 6:50 guagay_wk asked Nov 8, 2015 at 5:23 guagay_wkguagay_wk 28k63 gold badges198 silver badges309 bronze badges 2
  • see nodejs manual page - docs.npmjs.com/files/package.json#dependencies – Jaromanda X Commented Nov 8, 2015 at 5:25
  • I think what you might want is npm shrinkwrap docs.npmjs.com/cli/shrinkwrap – Keith M Commented Nov 8, 2015 at 5:27
Add a comment  | 

2 Answers 2

Reset to default 20

If you need exactly v0.7.1, use "nodemailer": "0.7.1", delete nodemailer under node_modules and run npm install again.

Another way to do this is to run the command:

npm remove nodemailer
npm install [email protected] --save

use this command to install nodemailer with 0.7 version else it will give error while sending emails

npm install [email protected] --save

var nodemailer = require("nodemailer");

var smtpTransport = nodemailer.createTransport("SMTP",{
   service: "Gmail",
   auth: {
       user: "EMAIL",
       pass: "PASSWORD"
   }
});

var mail = {
    from: "[email protected]",
    to: "[email protected]",
    subject: "Send Email Using Node.js",
    text: "Node.js New world for me",
    html: "<b>Node.js New world for me</b>"
}

smtpTransport.sendMail(mail, function(error, response){
    if(error){
        console.log(error);
    }else{
        console.log("Message sent: " + response.message);
    }

    smtpTransport.close();
});
发布评论

评论列表(0)

  1. 暂无评论