Closed DBTK1990 closed 1 year ago
I don't get why you're trying to use NestJS's CLI without having dev dependencies installed.
Instead, you should do this:
npm i # install all deps
npm run build
npm install --omit=dev
npm run start:prod
However, by doing some tests, the command that causes the error is the following
npm install --omit=dev
following the procedure described by @DBTK1990.
in fact not using npm install --omit=dev
the procedure works correctly. (see screenshot) in a local or dev environment
also using the procedure listed by @micalevisk, the error is not generated ( see screenshot )
in conclusion it occurs to me that the error is generated by an incorrect command procedure, there is an issue like this open in the nest-cli repository see here, waiting for a minimal reproduction, most likely I think it's a very similar problem to this.
I hope I was helpful
hey guys,
i know that if we don't use npm install --omit=dev
it will work.
currently we fixed it by using the npm install
without the omit but i can think on a couple of usages for this.
@micalevisk
I don't get why you're trying to use NestJS's CLI without having dev dependencies installed.
Instead, you should do this:
npm i # install all deps npm run build npm install --omit=dev npm run start:prod
but if we do this we cannot use nest start
command because this command creates a different build process
and the nest start is my npm prod (can see it in the issue) command because we need the swagger site on some environments (QA,DEV,STAGE)
@Tony133 do you think i need to move the issue to nestjs/cli repo? if there is another way to run the swagger outside of nest start i will be glad to know. because when we use the command of nest build it does not create the a build for swagger too.
@Tony133 pensi che debba spostare il problema nel repository nestjs/cli?
Yes, maybe it was to be opened in the nestjs-cli repository, but anyway now that it has been opened in this repository by now better not to create another issue in another repository, at most the NestJS core team will move it directly to the repository where they think it is most suitable after an evaluation.
if there is another way to run the swagger outside of nest start i will be glad to know.
For swagger, if you are looking for a plugin alternative, you can manually declare all decorators or only specific decorators where you need them, see here. Currently, I have always used the @nestjs/swagger
package to manage swagger with NestJS.
If you're using the start command just because of the swagger plugin, I guess you could try this: https://docs.nestjs.com/openapi/cli-plugin#integration-with-ts-jest-e2e-tests
Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.
Is there an existing issue for this?
Current behavior
get an error when trying to build nest app with swagger on it as a plugin but first you need to omit dev-dependencies i saw issue https://github.com/nestjs/nest/issues/9650 and its pretty much the same
his solution was to change the node env to development from production but when we set it to production, the default behavior for npm is to not install dev-dependencies and when we set it to something other then that the dev-dependencies will be install by npm
this is a bug on your part, please fix :)
Minimum reproduction code
~
Steps to reproduce
Expected behavior
build succeed and site is served
Package
Other package
@nestjs/swagger
NestJS version
9.0.3
Packages versions
Node.js version
16.14
In which operating systems have you tested?
Other
No response