#start:dev script dont stop reloading
36 messages · Page 1 of 1 (latest)
[System Information]
OS Version : macOS 23.4.0
NodeJS Version : v20.10.0
YARN Version : 1.22.19
[Nest CLI]
Nest CLI Version : 10.3.2
[Nest Platform Information]
platform-socket.io version : 10.3.3
platform-express version : 10.3.3
cache-manager version : 2.2.1
event-emitter version : 2.0.4
mapped-types version : 2.0.5
websockets version : 10.3.3
schematics version : 10.1.1
mongoose version : 10.0.4
passport version : 10.0.3
schedule version : 4.0.1
terminus version : 10.2.3
swagger version : 7.3.0
testing version : 10.3.3
common version : 10.3.3
config version : 3.2.0
axios version : 3.0.2
bull version : 10.1.0
core version : 10.3.3
jwt version : 10.2.0
cli version : 10.3.2
version : 2.0.2
Ok. When it hangs, can you see what module it is working on?
Give me a second, i will record the screen
How are you calling the start script?
"scripts": {
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start:dev": "NODE_ENV=local nest start --watch",
"start:debug": "nest start --debug --watch",
"start:build": "node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json"
},
yarn start:dev
Try
NEST_DEBUG=true yarn start:dev and see what happens.
What is the intention of setting NODE_ENV to "local"?
Ill send you a wetransfer with the video
1 file sent via WeTransfer, the simplest way to send your files around the world
i have tried removing the NODE_ENV
and it keeps reloading
Do you also have any code that is writing or updating files?
In other words, can you run yarn build with no issue?
yes
Yes to which question?
So, do you have code that is updating files during bootup?
nope
this is why i use the NODE_ENV=local
@Module({
imports: [
LoggerModule.forRoot({
pinoHttp:
process.env.NODE_ENV === 'local'
? {
timestamp: true,
level: process.env.ENV !== 'production' ? 'trace' : 'debug',
transport: {
target: 'pino-pretty',
options: {
messageKey: 'message',
colorize: true,
singleLine: true,
ignore: 'pid,hostname'
}
},
autoLogging: false,
messageKey: 'message',
customProps: (req, _res) => {
return {
correlation: (req as CorrelationRequest)[
CORRELATION_ID_HEADER
]
}
},
serializers: {
req: (req: Request) => undefined,
res: (res: Response) => undefined
}
}
: {}
})
]
})
export class AuditModule {
configure(consumer: MiddlewareConsumer) {
consumer.apply(CorrelationIdMiddleware).forRoutes('*')
}
}
this is my nest-cli.json
{
"$schema": "https://json.schemastore.org/nest-cli",
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"compilerOptions": {
"assets": [
{
"include": "/templates/**/*.hbs",
"outDir": "/dist/templates",
"watchAssets": true
}
],
"deleteOutDir": true,
"plugins": [
{
"name": "@nestjs/swagger",
"options": {
"classValidatorShim": false,
"typeFileNameSuffix": [
".input.ts",
".dto.ts",
".args.ts",
".entity.ts",
".response.ts",
".model.ts"
],
"introspectComments": true
}
}
]
}
}
Hmm.. the Swagger plugin does write to the files AFAIK:
Was your app working at all at any point?
yess
i've implemented this script to make the script work
and then i just call setupSwagger at main.ts
i've implemented this script to make the script work
To make what script work?
Yeah, so this is too convoluted to figure out like this. And, I don't use Swagger or the CLI plugin.
its weird because now it works but maybe tomorrow starts reloading in a loop
So, I'm not going to be much help. And I'm not even sure the Swagger plugin is the issue.
I dont think soo because i have a colleague that uses the same script on other project and it's working fine
🤷🏻♂️