Next.js: next dev constantly errors when using emacs, failing to load emacs lock files

Created on 17 Jul 2020  路  4Comments  路  Source: vercel/next.js

Bug report

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.

To Reproduce

  1. Run next dev
  2. Develop your .js files using emacs
  3. Observe errors like:
(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.

Expected behavior

I expected to not get these errors

System information

  • OS: Ubuntu 18
  • Version of Next.js: 9.4.4
  • Version of Node.js: 10.21.0

Additional context

I tried adding a webpack ignore filter to ignore these files, but it did not have any effect.

Most helpful comment

This is still an issue, disabling lockfiles for emacs is _not_ a good fix for this at all.

All 4 comments

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.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

irrigator picture irrigator  路  3Comments

knipferrc picture knipferrc  路  3Comments

rauchg picture rauchg  路  3Comments

renatorib picture renatorib  路  3Comments

jesselee34 picture jesselee34  路  3Comments