egg: TypeError: Cannot set property router of # which has only a getter

What happens?

今天使用nom run autod 更新了项目的依赖后,所有的controller层的单元测试都不能通过了,连最基础的test/app/controller/home.test.js 也是。 然后新开了一个项, run test 也是一样的错误。 报错 TypeError: Cannot set property router of #<Object> which has only a getter

最小可复现仓库

请使用 egg-init --type=simple bug 创建,并上传到你的 GitHub 仓库

复现步骤,错误日志以及相关配置

$ npm i egg-init -g
$ egg-init egg-example --type=simple
$ cd egg-example
$ npm I
$ npm run test

image

相关环境信息

  • 操作系统:Mac
  • Node 版本:9.11.2
  • Egg 版本:2.15.1

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (6 by maintainers)

Most upvoted comments

Egg 的依赖,请坚持用 ^,我们保证会严格遵循 Semver 规则。

@JackChius 把 yarn.lock 删掉,如果没有 yarn.lock,查一下你 package.json 里的 egg 依赖版本是不是写死了