最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to start NestJS application with yarn berry on production stage? - Stack Overflow

programmeradmin0浏览0评论

I am currently developing a NestJS application using Yarn Berry as the package manager, and I have encountered an issue.

I would like to run the already built files directly using the node dist/main.js command in the production environment instead of using the yarn start command. However, an error occurs when I try to do this.

In fact, I faced a similar issue before. When using the default NestJS nest command, I encountered errors like Cannot find module for all import statements, such as import { Module } from '@nestjs/common';, when using the nest start command. To resolve this, I installed the VSCode-specific Yarn SDKs and started using the yarn start command instead of nest, which allowed the application to run without any issues.

However, in the production environment, it is more efficient to run the already built files directly instead of using the yarn start command. When I use node dist/main.js, I get the error Error: Cannot find module '@nestjs/common'.

For those developing NestJS applications with Yarn Berry, how do you run the built files in a production environment?

发布评论

评论列表(0)

  1. 暂无评论