Search code examples
loopback

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


I'm getting an extremely weird error when trying to npm start my loopback application. I literally did nothing to the code and then this all of a sudden started to happen

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)

I have the same exact code in another file (which i actually created a git repo from using this repo) but this one is throwing this error for some reason


Solution

  • I went through the same issue.
    Apparently there are caches which need to clean up before starting the application. (Expired caches also appear in openapi before I get into this issue)

    The project needs to be clean and re-install packages by following:

    npm run clean
    npm install