When using next dev with emacs, as you develop, emacs creates symbolic link files starting with .# as lock files. Next.js seems to attempt to load these but fails, spewing out errors constantly.
next dev.js files using emacs(node:13646) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, stat '/home/lacker/twitroid/pages/.#app.js'
(node:13646) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:13646) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I expected to not get these errors
I tried adding a webpack ignore filter to ignore these files, but it did not have any effect.
A couple other notes that might help - I saw that create-react-app had a similar issue recently at https://github.com/facebook/create-react-app/issues/9056 . The workaround there of putting (setq create-lockfiles nil) in your .emacs file does work to suppress the errors, but it does so by having emacs no longer create lock files, which is dangerous because then emacs and git will overwrite each others' changes without emacs noticing.
To disable lockfiles for a specific project only https://stackoverflow.com/questions/62567370/reactjs-local-server-crashes-after-editing-file-in-emacs-even-without-saving
I posted a comment in #8238 as well.. This is easy to reproduce via:
host:next.js kjmph$ ln -s notexists examples/basic-css/pages/testfile
host:next.js kjmph$ yarn next ./examples/basic-css/
yarn run v1.22.10
$ node --trace-deprecation packages/next/dist/bin/next ./examples/basic-css/
ready - started server on http://localhost:3000
[Error: ENOENT: no such file or directory, stat '/home/kjmph/next.js/examples/basic-css/pages/testfile'] {
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: '/home/kjmph/next.js/examples/basic-css/pages/testfile'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I'm causing it to manifest slightly differently, yet it appears to be the same thing.
This is still an issue, disabling lockfiles for emacs is _not_ a good fix for this at all.
Most helpful comment
This is still an issue, disabling lockfiles for emacs is _not_ a good fix for this at all.