微信小程序云端函数报错解决方案

VM4174:1 thirdScriptError
errCode: -1  | errMsg: Cloud API isn't enabled, please call wx.cloud.init first
请先调用 wx.cloud.init() 完成初始化后再调用其他云 API。init 方法可传入一个对象用于设置默认配置,详见文档。;at "pages/home/home" page lifeCycleMethod onLoad function
Error: errCode: -1  | errMsg: Cloud API isn't enabled, please call wx.cloud.init first
请先调用 wx.cloud.init() 完成初始化后再调用其他云 API。init 方法可传入一个对象用于设置默认配置,详见文档。
    at new t (http://127.0.0.1:12631/appservice/__dev__/WAService.js:22:14994)
    at Object.exportAPI.(anonymous function) [as callFunction] (http://127.0.0.1:12631/appservice/__dev__/WAService.js:20:15330)
    at c.getOPenid (http://127.0.0.1:12631/appservice/pages/home/home.js:79:12)
    at c.onLoad (http://127.0.0.1:12631/appservice/pages/home/home.js:33:8)
    at c.<anonymous> (http://127.0.0.1:12631/appservice/__dev__/WAService.js:19:16763)
    at $t (http://127.0.0.1:12631/appservice/__dev__/WAService.js:19:30369)
    at on (http://127.0.0.1:12631/appservice/__dev__/WAService.js:20:235)
    at sn (http://127.0.0.1:12631/appservice/__dev__/WAService.js:20:573)
    at Function.<anonymous> (http://127.0.0.1:12631/appservice/__dev__/WAService.js:20:3006)
    at L.<anonymous> (http://127.0.0.1:12631/appservice/__dev__/WAService.js:19:1500)

这个困扰我了很长时间

解决方案

1、首先确认云开发已经开通了,开通以后要过十几分钟才能使用

2、然后确认项目的基础库版本,在开发工具右上角的"详情"按钮,可以选择调试基础库的版本,要2.2.3或以上才行

3、最后看看项目根目录下的app.js文件中,在onLaunch方法中是否有:

    wx.cloud.init({

        traceUser: true,

    })

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

飞飞翼

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值