简体   繁体   中英

Unable to install sendgrid on azure

I follow this guide to install sendgrid on my azure web service: https://docs.microsoft.com/en-us/azure/store-sendgrid-nodejs-how-to-send-email

The question is regarding the npm install sendgrid command.

When i run it on my console I get the following error, and the sendgrid do not get installed.

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

I also tried to install the package in the script editing portal on azure where I got the following result.

\> 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)

I also get this error: typeerror sendgrid.email is not a function when running this code:

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

Looks like the sendgrid package which you are using is deprecated. Please try uninstalling this one and install the one below -

npm i @sendgrid/mail

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM