Nodemailer error when required

╄→尐↘猪︶ㄣ 提交于 2019-12-05 15:17:47

Looks like a node version issue to me. The spread operator is not valid on earlier versions of Node,, check to make sure you are running a version that supports ES6 features.

Node.js version 6+ is must. Check your Node version with the following command:

node --version

If you are not at least 6+ then you must upgrade.

You may receive another error message instructing you to login to your account. In that case, go to your email inbox and you will see a message from Google with a link to a page for setting up less secure app permissions.

Nodemailer is compatible with Node version 6 or above (as per https://nodemailer.com/about/#requirements)

So follow these steps to upgrade node:

1* sudo npm cache clean -f

2* sudo npm install -g n

3* sudo n stable

4* sudo ln -sf /usr/local/n/versions/node/5.4.1/bin/node /usr/bin/node (the bold text/version should be the one installed in during above step.)

ie if 8.1.1 is installed then do sudo ln -sf /usr/local/n/versions/node/8.1.1/bin/node /usr/bin/node

node –v (Should show updated version now)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!