【问题标题】:Unable to install sendgrid on azure无法在 Azure 上安装 sendgrid
【发布时间】:2018-07-05 11:56:18
【问题描述】:

我按照本指南在我的 azure Web 服务上安装 sendgrid: https://docs.microsoft.com/en-us/azure/store-sendgrid-nodejs-how-to-send-email

问题与npm install sendgrid 命令有关。

当我在控制台上运行它时,我收到以下错误,并且 sendgrid 没有安装。

npm WARN package.json azure-mobile-apps-quickstarts.backend.node.try-mobile-apps@0.0.1 No README.md file found!
npm http GET https://registry.npmjs.org/sendgrid
npm http GET https://registry.npmjs.org/sendgrid
npm http GET https://registry.npmjs.org/sendgrid
npm ERR! Error: SSL Error: CERT_UNTRUSTED
npm ERR!     at ClientRequest.<anonymous> (D:\Program Files (x86)\nodejs\node_modules\npm\node_modules\request\main.js:440:26)
npm ERR!     at ClientRequest.g (events.js:156:14)
npm ERR!     at ClientRequest.emit (events.js:67:17)
npm ERR!     at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1256:7)
npm ERR!     at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:91:29)
npm ERR!     at CleartextStream.socketOnData [as ondata] (http.js:1288:20)
npm ERR!     at CleartextStream._push (tls.js:375:27)
npm ERR!     at SecurePair.cycle (tls.js:734:20)
npm ERR!     at EncryptedStream.write (tls.js:130:13)
npm ERR!     at Socket.ondata (stream.js:38:26)
npm ERR!  [Error: SSL Error: CERT_UNTRUSTED]
npm ERR! You may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Windows_NT 6.2.9200
npm ERR! command "D:\\Program Files (x86)\\nodejs\\\\node.exe" "D:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "sendgrid"
npm ERR! cwd D:\home\site\wwwroot
npm ERR! node -v v0.6.20
npm ERR! npm -v 1.1.37
npm ERR! message SSL Error: CERT_UNTRUSTED

我还尝试在 azure 上的脚本编辑门户中安装该软件包,结果如下。

\> npm install sendgrid
npm WARN package.json azure-mobile-apps-quickstarts.backend.node.try-mobile-apps@0.0.1 No README data
npm WARN deprecated sendgrid@5.2.3: Please see v6.X+ at https://www.npmjs.com/org/sendgrid
npm WARN deprecated mailparser@0.6.2: This project is unmaintained
npm WARN deprecated mimelib@0.3.1: This project is unmaintained
sendgrid@5.2.3 node_modules\sendgrid
├── lodash.chunk@4.2.0
├── sendgrid-rest@2.4.0
├── bottleneck@1.16.0
├── async.queue@0.5.2 (async.util.queue@0.5.2)
├── async.ensureasync@0.5.2 (async.util.ensureasync@0.5.2)
└── mailparser@0.6.2 (uue@3.1.2, encoding@0.1.12, mimelib@0.3.1)

我也收到此错误:typeerror sendgrid.email is not a function 运行此代码时:

var email = new sendgrid.Email({
    to: 'john@contoso.com',
    from: 'anna@contoso.com',
    subject: 'test mail',
    text: 'This is a sample email message.'
});

【问题讨论】:

  • 您是否尝试绕过此证书?顺便说一句,看起来它是在第二次尝试中安装的?
  • 问题开始于何时使用函数 var email = new sendgrid.Email({ to: 'john@contoso.com', from: 'anna@contoso.com', subject: 'test mail ', text: '这是一封示例电子邮件。' });它说 .Email 功能是类型错误
  • 抱歉,我没听懂。
  • 问题开始于何时使用函数 var email = new sendgrid.Email({..... });获取错误:typeerror sendgrid.email 不是函数
  • @eduPeeth 在 api 中更新了一条错误消息

标签: azure email installation sendgrid


【解决方案1】:

看起来您正在使用的 sendgrid 包已被弃用。请尝试卸载这个并安装下面的 -

npm i @sendgrid/mail

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-05-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多