Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

next dev constantly errors when using emacs, failing to load emacs lock files #15278

Closed
lacker opened this issue Jul 17, 2020 · 9 comments · Fixed by #20497
Closed

next dev constantly errors when using emacs, failing to load emacs lock files #15278

lacker opened this issue Jul 17, 2020 · 9 comments · Fixed by #20497

Comments

@lacker
Copy link

lacker commented Jul 17, 2020

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.

@lacker
Copy link
Author

lacker commented Jul 17, 2020

A couple other notes that might help - I saw that create-react-app had a similar issue recently at facebook/create-react-app#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.

@ignacio-gc
Copy link

@kjmph
Copy link

kjmph commented Oct 28, 2020

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.

@Mstrodl
Copy link

Mstrodl commented Nov 3, 2020

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

@dmlap
Copy link

dmlap commented Dec 22, 2020

I spent some time digging into this myself. The unhandled promise rejection looks to be coming from this issue: paulmillr/chokidar#955

@dmlap
Copy link

dmlap commented Dec 22, 2020

As an alternate workaround to disabling emacs lockfiles, applying this patch directly to chokidar/lib/nodejs-handler.js solved the problem for me.

lfender6445 added a commit to lfender6445/next.js that referenced this issue Dec 26, 2020
@lfender6445
Copy link

I have a fix for this staged here

#20497

if you are using a custom webpack configuration, you can extend the existing config until the fix is released, maybe something like this

config.watchOptions = config.watchOptions.concat('**/.#*')

lfender6445 added a commit to lfender6445/next.js that referenced this issue Dec 26, 2020
- also updates gitignore

Fixes: vercel#15278
lfender6445 added a commit to lfender6445/next.js that referenced this issue Dec 29, 2020
- also updates gitignore

Fixes: vercel#15278
lfender6445 added a commit to lfender6445/next.js that referenced this issue Dec 29, 2020
- also updates gitignore

Fixes: vercel#15278
@kodiakhq kodiakhq bot closed this as completed in #20497 Dec 29, 2020
kodiakhq bot pushed a commit that referenced this issue Dec 29, 2020
Fixes: #15278

> 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.

Prevents dev server from crashing when emacs creates lockfiles

tested with:

- GNU Emacs 27.1
- OSX 11.1
- Node v15.4.0
@ZelphirKaltstahl
Copy link

ZelphirKaltstahl commented Sep 21, 2021

Voting to reopen this issue, as it is still an issue with [email protected].
Why did the bot close this ongoing issue?

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants