Prasanga Thapaliya
Prasanga Thapaliya

Reputation: 727

Logs in the console stuck saying [12:06:59 PM] File change detected. Starting incremental compilation in nestjs

When I start the nest application, then it successfully starts and shows the logs given below.

I've used command npm run dev:start to start the project.

[11:55:17 AM] File change detected. Starting incremental compilation...

[11:55:17 AM] Found 0 errors. Watching for file changes.

[Nest] 23860   - 05/19/2021, 11:55:18 AM   [NestFactory] Starting Nest application...
[Nest] 23860   - 05/19/2021, 11:55:18 AM   [InstanceLoader] AppModule dependencies initialized +106ms
[Nest] 23860   - 05/19/2021, 11:55:18 AM   [InstanceLoader] TypeOrmModule dependencies initialized +1ms
[Nest] 23860   - 05/19/2021, 11:55:18 AM   [InstanceLoader] TypeOrmCoreModule dependencies initialized +24ms
[Nest] 23860   - 05/19/2021, 11:55:18 AM   [RouterExplorer] Mapped {/auth/signup, POST} route +2ms
[Nest] 23860   - 05/19/2021, 11:55:18 AM   [RoutesResolver] PostController {/post}: +1ms
[Nest] 23860   - 05/19/2021, 11:55:18 AM   [RouterExplorer] Mapped {/post/create, POST} route +0ms
[Nest] 23860   - 05/19/2021, 11:55:18 AM   [RouterExplorer] Mapped {/post, GET} route +1ms
[Nest] 23860   - 05/19/2021, 11:55:18 AM   [RoutesResolver] CategoryController {/category}: +0ms
[Nest] 23860   - 05/19/2021, 11:55:18 AM   [RouterExplorer] Mapped {/category/create, POST} route +0ms
[Nest] 23860   - 05/19/2021, 11:55:18 AM   [NestApplication] Nest application successfully started +2ms
[Nest] 23860   - 05/19/2021, 11:55:18 AM   [bootstrap] Application started at localhost:5001

Now if I send any request to the end points, it successfully sends the request and data get stored in the database and also returns the data but the problem is code gets recompiled and in console it displays

[12:06:59 PM] File change detected. Starting incremental compilation...

and it doesn't show the log messages. How can I fix this?

Upvotes: 4

Views: 7265

Answers (5)

user1961312
user1961312

Reputation: 159

i don't know which dependency caused the issue in my case. but for me it just worked after i ran:

npm audit fix

Upvotes: 0

Hamid Mir
Hamid Mir

Reputation: 373

As mentioned in NestJs Documentation in Windows operating system for Typescript version 9+ we need to add following after compilerOptions in tsconfig file:

"watchOptions": { "watchFile": "fixedPollingInterval" }

Upvotes: 2

Kalevin
Kalevin

Reputation: 21

If the above doesn't work, here is how i fixed the issue

This is something related with your OS (Windows 11 in my case) and ts 4.9

Try it out with typescript 4.8 instead, in the package.json include

"devDependencies": {
  ...,
  "typescript": "4.8.3",
  ...
}

later

npm i
npm run start:dev

This might help you: https://devblogs.microsoft.com/typescript/announcing-typescript-4-9/#file-watching-changes

Upvotes: 2

Joseph Samuel
Joseph Samuel

Reputation: 19

if the above doesn't work, here is how i fixed the issue

for NestJS

inside the : tsconfig.build.json file

Add "include": ["./src"]

Looks like this

tsconfig.build.json

{
      "extends": "./tsconfig.json",
      "exclude": ["node_modules", "test", "dist", "**/*spec.ts"],
      "include": ["./src"]
    }

Upvotes: 0

bujhmt
bujhmt

Reputation: 179

Add to your tsconfig.json:

"include": [
    "src"
]

Upvotes: 3

Related Questions