【发布时间】:2017-09-29 08:53:09
【问题描述】:
我正在尝试在 Meteor 中使用sendgrid npm 包(在服务器上):
const sendgridMail = require('@sendgrid/mail');
不断收到此错误:
(STDERR) packages\modules.js:961
(STDERR) const {
(STDERR) ^
(STDERR)
(STDERR) SyntaxError: Unexpected token {
(STDERR) at Object.exports.runInThisContext (vm.js:53:16)
(STDERR) at D:\myProject\.meteor\local\build\programs\server\boot.js:331:30
(STDERR) at Array.forEach (native)
(STDERR) at Function._.each._.forEach (C:\Users\user1\AppData\Local\.meteor\packages\meteor-tool\1.5.2\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules\underscore\underscore.js:79:11)
有什么解决办法吗?
更新: package.json 包含以下依赖项:
"dependencies": {
"@sendgrid/client": "^6.1.4",
"@sendgrid/mail": "^6.1.4",
"babel-runtime": "^6.20.0",
"bcrypt": "^1.0.2",
"body-parser": "^1.17.2",
"card": "^2.3.0",
"google-auth-library": "^0.10.0",
"googleapis": "^21.3.0",
"meteor-node-stubs": "~0.2.4",
"moment": "^2.18.1",
"pnotify": "^3.2.0",
"shortid": "^2.2.8",
"simpl-schema": "^0.3.1",
"stripe": "^4.24.0"
}
【问题讨论】:
-
请出示您的
package.json。 -
而且,可以肯定的是,当你删除这个
require()时,错误就会消失,对吧? -
是的,去掉 require() 后,它工作正常
标签: meteor sendgrid sendgrid-api-v3