'Nest.js swagger plugin not found under jenkins

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!



Solution 1:[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"]
}

Solution 2:[2]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nico
Solution 2 alexktz