2

With Nest.js i'm using @nestjs/swagger plugin. all works well on dev. in jekins, i'm pulling the code, and doing a build. For that, i have installed nest cli on the server. i'm getting this error at the build stage:

> nest build
Error  "@nestjs/swagger/plugin" plugin could not be found!

what am i doing wrong? server is ubuntu 17, in my nest-cli.json i have this:

{
  "collection": "@nestjs/schematics",
  "sourceRoot": "src",
  "compilerOptions": {
    "plugins": ["@nestjs/swagger/plugin"]
  }
}

and again, it works fine locally. problem is only on jenkins workspace. thanks!

Ron Al
  • 397
  • 1
  • 6
  • 19

3 Answers3

1

I had exactly the same issue.

I solved it with this:

  1. Make sure you have nestcli installed: npm i -g @nestjs/cli
  2. Update nestcli on deployment before you make npm install: nest update
  3. If this not helps, try another Swagger-Version. I had the problem with version 4.5.9, I upgraded to @nestjs/swagger": "^4.5.11 and it helped.

Hope this works for you.

alexktz
  • 48
  • 6
1

Nest plugin can be found under your node_modules directory under: @nestjs/swagger/dist/plugin

This should be set in your complier options:

"compilerOptions": {
     "plugins": ["@nestjs/swagger/dist/plugin"]
}
Nico
  • 58
  • 7
1

I recommend anyone who is encountering this error to put a log into the cli source code at exactly here.

The nest cli hides the true error message from requiring plugins - so it could be a whole host of issues.

In my case I was missing reflect-metadata package after switching over to a new monrepo.

Module 'reflect-metadata' not found

So just make sure you have all the required modules for NestJS

Daniel Cooke
  • 1,426
  • 12
  • 22