NextJS not properly handling v3 package-lock.json in absence of .next directory #36817
Closed
1 task done
Labels
bug
Issue was opened via the bug report template.
Verify canary release
Provide environment information
What browser are you using? (if relevant)
n/a
How are you deploying your application? (if relevant)
next dev
Describe the Bug
When using a v3 package-lock.json file, NextJS outputs the following when running
npm run dev
:The problem is that the lockfile already has the swc native dependencies in it. This can be confirmed because the swc minifier works as expected, and this process does not actually alter the lockfile in a meaningful way.
NextJS alters the lock file by removing the final new line from the bottom, but no other content in the file is changed. Then (as per the instructions) I run
npm install
, and the only thing that happens is that the new line is re-added and git no longer marks the file as modified.If I then run
npm run dev
again, I do not get the warning messages:At this point, if I delete the .next directory and run dev again, the whole process starts all over. Same if I run a dev vs production build, so my conclusion is that the message is somehow related to the build output / build cache.
Expected Behavior
I expect that NextJS does not modify my lockfile at all and instead just provides me with instructions of how to remedy the situation myself.
The warning given is a false alarm anyway because the lock file is not altered in any way except for the newline missing at the end; the swc dependencies are already there, so I also expect that NextJS does not report this as a warning in the first place.
To Reproduce
npx create-next-app@latest --use-npm
.npmrc
file containing:npm install
to convert the lockfile from v2 to v3swcMinify: true
tonext.config.js
npm run dev
npm install
as per the instructions in the command outputnpm run dev
.next
directorynpm run dev
npm install
and the lock file is back to what it was beforeThe text was updated successfully, but these errors were encountered: