Skip to content
Advertisement

why I can’t delete .next folder in nextjs project

I run my nextjs project by

npm run dev

NOT

npm run build

but it automatically create the .next folder. and after I tried to delete that folder but it automatically generated again. why??

I don’t expect to generate the .next folder by this command:

npm run dev

Answer

You are running your project with

npm run dev

Once the project is launched, .next folder will be created to store page cache and some features to speed up your project. While project running, some files will be added to .next folder during your dev usage. If you delete you .next folder during usage, you will have errors on the pages – you should restart your npm run dev

Advertisement