sma*_*ver 1 node.js sendgrid express
我正在尝试使用sendrid上的以下doc发送电子邮件:
https://sendgrid.com/docs/Integrate/Code_Examples/v2_Mail/nodejs.html
我的app.js看起来像这样:
var sendgrid = require('sendgrid')('SENDGRID_APIKEY');
Run Code Online (Sandbox Code Playgroud)
当runnig npm start时,我收到以下错误:
var sendgrid = require('sendgrid')(conf);
^
TypeError: require(...) is not a function
at Object.<anonymous> (C:\Users\Grandullon\Desktop\angular\app.js:8:36)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (C:\Users\Grandullon\Desktop\angular\bin\www:7:11)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
Run Code Online (Sandbox Code Playgroud)
我有什么想法我做错了吗?conf是我存储API密钥的变量.
我正在使用干净的快递安装.
谢谢
我的package.json可以按照要求在这里查看:
在最新的文件显示初始化不同的结构.
你应该尝试做
var sg = require('sendgrid').SendGrid(conf);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1572 次 |
| 最近记录: |