nodejs.ReferenceError: ctx is not defined解决方法
【现象】
2022-01-17 18:32:26,958 ERROR 18500 [-/::1/-/1ms GET /findOne/1] nodejs.ReferenceError: ctx is not definedat HomeController.findOne (..\showcase\app\controller\home.js:18:22)at Object.callFn (..\showcase\node_modules\egg-core\lib\utils\index.js:44:21)at Object.classControllerMiddleware (..\showcase\node_modules\egg-core\lib\loader\mixin\controller.js:87:20)
at Object.callFn (..\showcase\node_modules\@eggjs\router\lib\utils.js:12:21)
解决方法:
const user = await ctx.service.user.find({id:id});
修改为:
const user = await this.ctx.service.user.find({id:id});
nodejs.ReferenceError: ctx is not defined解决方法相关推荐
- ReferenceError: regeneratorRuntime is not defined解决方法
ReferenceError: regeneratorRuntime is not defined解决方法 参考文章: (1)ReferenceError: regeneratorRuntime is ...
- Uncaught ReferenceError: regeneratorRuntime is not defined 解决方法
项目突然报错Uncaught ReferenceError: regeneratorRuntime is not defined 之前老版本的babel不能正常发挥作用,导致浏览器无法翻译es7语法, ...
- python __file__ is not defined 解决方法
python __file__ is not defined 解决方法 参考文章: (1)python __file__ is not defined 解决方法 (2)https://www.cnbl ...
- python reload is not defined_name 'reload' is not defined解决方法
今天在学习scrapy的时候,在网上找了一段代码,运行出了一点问题. 命令行报错: name 'reload' is not defined 原因是,python版本的问题 原代码如下: import ...
- php-fpm:No pool defined解决方法
[root@localhost etc]# service php-fpm start Starting php-fpm [28-Nov-2016 17:13:23] WARNING: Nothing ...
- Uncaught ReferenceError: xxx is not defined 解决办法
VM11371:1 Uncaught ReferenceError: inputSize is not defined at <anonymous>:1:1 解决办法(根据需求调整 ...
- name ‘train_test_split‘ is not defined解决方法
from sklearn.utils._testing import all_estimators estimators = all_estimators(type_filter='classifie ...
- Espressif-IDE NameError: name ‘websocket‘ is not defined 解决方法
前言 ESP32 具有wifi 与 蓝牙,性价比比较高,一些嵌入式开发中经常用到,最近更新了一下 ESP32的开发环境, ESP32 开发工具下载地址:https://dl.espressif.cn/ ...
- FCK编辑器空白,报错:FCKConfig is not defined, FCKBrowserInfo is not defined解决方法
编辑器空白的问题.并且报有:FCKConfig is not defined, FCKBrowserInfo is not defined,FCKConfig_LoadPageConfig is no ...
最新文章
- redis入门(03)redis的配置
- linux(系统centos6.5)常用命令总结
- php从mysql资源类型_php从mysql里读出来的数据默认什么类型?
- Spring+Mybatis多数据源配置(三)——Spring如何获取Properties文件的信息
- nssl1469-W【dp】
- 基于生成对抗网络的医学数据域适应研究
- Exception的妙用
- sv_labs学习笔记——sv_lab5_上(System Verilog)
- xtu DP Training C.炮兵阵地
- linux shell 数字雨,cmd命令如何实现数字雨
- 《软件开发》串口调试助手
- 无法安装64位版本的Office,因为在您的PC上找到了以下32位程序……解决办法
- Java支付宝订单查询
- srs源码分析2-浅析state_threads
- mongodb连接不上的问题Exception thrown during connection pool background maintenance task
- 【原理分析】Google炫炸天的平衡自行车仅仅是概念吗?来看看惯性轮自行车吧...
- deepin20无法启动图形界面_U盘启动盘暗藏推广?用它来打造安全个性的PE工具箱...
- python合并两个数据集_《利用Python进行数据分析》第7章 合并数据集
- 前端开发基础——网络相关(TCP、UDP、HTTP等)
- TCP实现P2P通信