how to fix #39;parsing error: Unexpected token =gt;#39; in node?(如何修复#39;解析错误:节点中的意外标记=39;?)
本文介绍了如何修复';解析错误:节点中的意外标记=&>&39;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Firebase函数进行条带支付集成。此特定功能用于使用条带注册客户。
节点版本10.15.3,
NPM版本6.9.0,
"ecmaVersion":.eslintrc.json中的6
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
const stripe = require('stripe')(functions.config().stripe.testkey)
exports.createStripeCustomer = functions.auth.user()
.onCreate(async (user) => {
const customer = await
stripe.customers.create({email: user.email});
await admin.firestore()
.collection('stripe_customers')
.doc(user.uid)
.set({customer_id: customer.id});
});
代码与GitHub示例中提供的FireBase平台相同
https://github.com/firebase/functions-samples/blob/master/stripe/functions/index.js
分析错误:意外令牌=>
如果我在.eslintrc.json中将"ecmaVersion":6更改为"ecmaVersion":8
then error is .onCreate(async (user) => {
^
SyntaxError: Unexpected token (
我希望正确部署功能,以便用户可以在Firebase存储中条带和日期存储上注册
推荐答案
确保您在本地计算机节点>=8上运行。要进行部署,您的Package.json中应该有。
{
//...
"engines": {
"node": "8"
},
//...
}
对于eslint,要启用对异步函数的解析,您应该在配置中包括以下内容:
{
"parserOptions": {
"ecmaVersion": 2017
}
}
这篇关于如何修复';解析错误:节点中的意外标记=&>&39;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
编程基础网
本文标题为:如何修复';解析错误:节点中的意外标记=&>&39;?
基础教程推荐
猜你喜欢
- 逻辑运算符 ||在 javascript 中,0 代表 Boolean false? 2022-01-01
- 最佳动态 JavaScript/JQuery 网格 2022-01-01
- 当木偶师打开Chrome时,不能使用Chrome扩展 2022-01-01
- HTML5 画布调整为父级 2022-01-01
- 使用 jQuery 在悬停时交换 DIV 类 2022-01-01
- 即使每次插入第一个输入的值不同,第二个输入仍显示相同的输入值 2022-01-01
- CORS:当凭据标志为真时,无法在 Access-Control-Allow-Origin 中使用通配符 2022-01-01
- 从快速中间件中排除路由 2022-01-01
- 在 Javascript 中使用 Fetch API 上传文件并显示进度 2022-01-01
- 带角度的选项卡:仅使用 $http 在单击时加载选项卡 2022-01-01
