【现象】

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解决方法相关推荐

  1. ReferenceError: regeneratorRuntime is not defined解决方法

    ReferenceError: regeneratorRuntime is not defined解决方法 参考文章: (1)ReferenceError: regeneratorRuntime is ...

  2. Uncaught ReferenceError: regeneratorRuntime is not defined 解决方法

    项目突然报错Uncaught ReferenceError: regeneratorRuntime is not defined 之前老版本的babel不能正常发挥作用,导致浏览器无法翻译es7语法, ...

  3. python __file__ is not defined 解决方法

    python __file__ is not defined 解决方法 参考文章: (1)python __file__ is not defined 解决方法 (2)https://www.cnbl ...

  4. python reload is not defined_name 'reload' is not defined解决方法

    今天在学习scrapy的时候,在网上找了一段代码,运行出了一点问题. 命令行报错: name 'reload' is not defined 原因是,python版本的问题 原代码如下: import ...

  5. php-fpm:No pool defined解决方法

    [root@localhost etc]# service php-fpm start Starting php-fpm [28-Nov-2016 17:13:23] WARNING: Nothing ...

  6. Uncaught ReferenceError: xxx is not defined 解决办法

    VM11371:1 Uncaught ReferenceError: inputSize is not defined     at <anonymous>:1:1 解决办法(根据需求调整 ...

  7. name ‘train_test_split‘ is not defined解决方法

    from sklearn.utils._testing import all_estimators estimators = all_estimators(type_filter='classifie ...

  8. Espressif-IDE NameError: name ‘websocket‘ is not defined 解决方法

    前言 ESP32 具有wifi 与 蓝牙,性价比比较高,一些嵌入式开发中经常用到,最近更新了一下 ESP32的开发环境, ESP32 开发工具下载地址:https://dl.espressif.cn/ ...

  9. FCK编辑器空白,报错:FCKConfig is not defined, FCKBrowserInfo is not defined解决方法

    编辑器空白的问题.并且报有:FCKConfig is not defined, FCKBrowserInfo is not defined,FCKConfig_LoadPageConfig is no ...

最新文章

  1. redis入门(03)redis的配置
  2. linux(系统centos6.5)常用命令总结
  3. php从mysql资源类型_php从mysql里读出来的数据默认什么类型?
  4. Spring+Mybatis多数据源配置(三)——Spring如何获取Properties文件的信息
  5. nssl1469-W【dp】
  6. 基于生成对抗网络的医学数据域适应研究
  7. Exception的妙用
  8. sv_labs学习笔记——sv_lab5_上(System Verilog)
  9. xtu DP Training C.炮兵阵地
  10. linux shell 数字雨,cmd命令如何实现数字雨
  11. 《软件开发》串口调试助手
  12. 无法安装64位版本的Office,因为在您的PC上找到了以下32位程序……解决办法
  13. Java支付宝订单查询
  14. srs源码分析2-浅析state_threads
  15. mongodb连接不上的问题Exception thrown during connection pool background maintenance task
  16. 【原理分析】Google炫炸天的平衡自行车仅仅是概念吗?来看看惯性轮自行车吧...
  17. deepin20无法启动图形界面_U盘启动盘暗藏推广?用它来打造安全个性的PE工具箱...
  18. python合并两个数据集_《利用Python进行数据分析》第7章 合并数据集
  19. 前端开发基础——网络相关(TCP、UDP、HTTP等)
  20. TCP实现P2P通信

热门文章

  1. 将手机号,银行卡,身份证只显示前三位和后四位。为了保护用户的信息
  2. 第6章 使用过滤器和监听器
  3. 安装Beautifulsoup失败解决方法之一,《文件名与库的名字一样》小白易犯的错误
  4. 什么样的蓝牙耳机通话效果好?蓝牙耳机通话效果最好排名
  5. 011-2018-09-17 迭代器和闭包
  6. @Valid的用法详解
  7. zbrush常用笔刷_1000款各种样式zbrush实用建模师笔刷包集合
  8. 湖南省2022年成人高考招生全国统一考试考生须知
  9. 软文发布时,这些平台固定规则要了解
  10. ZZY.QR 简单二维码生成编辑器