微信的开发者工具里提示我:[云函数] [login] 调用失败 Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail cloud function service error code -504002, error message Cannot find module 'wx-server-sdk'; at cloud.callFunction api;
后来在网上查到,是依赖包没安装:
如果你想在云函数中,操作文件、数据库和云函数资源,你可以使用我们提供的服务端 SDK 进行操作。首先,进入到你的某个云函数中,安装以下依赖包:
npm i --save tcb-admin-node
具体是怎么安装啊,不太明白,望大神赐教!!!
我按照你们说的方法,有下面的提示
D:\mycheck\cloudfunctions>npm i --save tcb-admin-node
npm WARN saveError ENOENT: no such file or directory, open 'D:\mycheck\cloudfunc
tions\package.json’
npm WARN enoent ENOENT: no such file or directory, open 'D:\mycheck\cloudfunctio
ns\package.json’
npm WARN cloudfunctions No description
npm WARN cloudfunctions No repository field.
npm WARN cloudfunctions No README data
npm WARN cloudfunctions No license field.
updated 1 package and audited 334 packages in 4.013s
found 0 vulnerabilities
运行时还是提示:
dboperate页面[云函数]setGroup执行失败 Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID 39c46994-35ee-11e9-95a7-5254005d5fdb, cloud function service error code -504002, error message errCode: -1 unknown error | errMsg: Cloud API isn’t enabled, please call init first
请先调用 init 完成初始化后再调用其他云 API。init 方法可传入一个对象用于设置默认配置,详见文档。; at cloud.callFunction api;