Cannot start the application. TypeError: Cannot read property 'definition' of undefined at getFieldsJsonSchemaFor

Cannot start the application. TypeError: Cannot read property 'definition' of undefined at getFieldsJsonSchemaFor

我在尝试 npm start 我的环回应用程序时遇到了一个非常奇怪的错误。我真的没有对代码做任何事情然后这一切突然开始发生

Cannot start the application. TypeError: Cannot read property 'definition' of undefined at getFieldsJsonSchemaFor (/Users/vikramkhemlani/Desktop/loopback/node_modules/@loopback/repository-json-schema/dist/filter-json-schema.js:101:64)

我在另一个文件中有完全相同的代码(我实际上使用这个 repo 创建了一个 git repo)但是这个文件由于某种原因抛出了这个错误

来自 LoopBack 团队的问候

这可能是最近更改引入的 LoopBack 中的错误。请创建一个重现该问题的小型应用程序(请参阅我们的 Bug reporting instructions) and open a new GitHub issue in https://github.com/strongloop/loopback-next/issues/new

我也遇到了同样的问题

但是,当我尝试以下方法时,我解决了它。

  • 删除 node_modules 目录。
  • npm 安装。

我遇到了同样的问题。
显然有一些缓存需要在启动应用程序之前清理。 (在我进入这个问题之前,过期的缓存也出现在openapi中)

项目需要清理并 re-install 通过以下方式打包:

npm run clean
npm install