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

Emacs lock files cause an UnhandledPromiseRejectionWarning in ng serve #18342

Open
vbraun opened this issue Jul 23, 2020 · 5 comments
Open

Emacs lock files cause an UnhandledPromiseRejectionWarning in ng serve #18342

vbraun opened this issue Jul 23, 2020 · 5 comments

Comments

@vbraun
Copy link

@vbraun vbraun commented Jul 23, 2020

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • xi18n
  • run
  • config
  • help
  • version
  • doc

Description

Emacs lock files cause an UnhandledPromiseRejectionWarning. The lock file .#filename is actually a symlink pointing nowhere and seems to break the webpack watcher. Also, the lock file is generated once I type anything into the emacs buffer (and not while saving), so there is no point in watching the lock files.

$ npm run start
[...]
chunk {main} main.js, main.js.map (main) 57.7 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 141 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 12.9 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 2.41 MB [initial] [rendered]
Date: 2020-07-23T08:30:17.123Z - Hash: 86e8ae79c0fc07f7c92b - Time: 5696ms
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
: Compiled successfully.
(node:3270950) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, stat '/home/vbraun/myproject/src/.#main.ts'
(node:3270950) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)

Apart from flooding the console with spurious errors the watch&rebuild seems to work

🔬 Minimal Reproduction


$ npx ng new
$ cd myproject
$ npm run start
$ emacs src/main.ts

🌍 Your Environment


$ npx ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 10.0.4
Node: 12.16.3
OS: linux x64

Angular: 2.4.10
... compiler, compiler-cli, core
Ivy Workspace: 

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.1000.4
@angular-devkit/core         10.0.4
@angular-devkit/schematics   10.0.4
@angular/cli                 10.0.4
@angular/tsc-wrapped         0.5.2
@ngtools/json-schema         1.1.0
@ngtools/webpack             1.10.2
@schematics/angular          10.0.4
@schematics/update           0.1000.4
rxjs                         6.5.5
typescript                   2.0.10
webpack                      2.2.0
@vbraun
Copy link
Author

@vbraun vbraun commented Jul 23, 2020

An even easier repro is to just create a dangling symlink in the project root:

$ ln -sf foo bar
$ npx ng serve
[...]
(node:3427060) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, stat '/home/vbraun/myproject/bar'
@alan-agius4
Copy link
Collaborator

@alan-agius4 alan-agius4 commented Jul 23, 2020

@vbraun, I tried to replicate this but I didn't get the mentioned error

➜  test git:(master) ✗ ln -sf foo bar
➜  test git:(master) ✗ ng serve

chunk {main} main.js, main.js.map (main) 60.6 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 141 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 13.5 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 2.64 MB [initial] [rendered]
Date: 2020-07-23T14:18:30.115Z - Hash: 595948837955d0f39f47 - Time: 4809ms
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
: Compiled successfully.


@vbraun
Copy link
Author

@vbraun vbraun commented Jul 23, 2020

Hmm, package version mismatch? I've just installed the newest from npm.

Downgrading to chokidar@2.1.8 kludges around the issue for me (either by downgrading to watchpack 1.6.1 or getting rid of watchpack's vendored version):

$ npm install chokidar@2.1.8
$ rm -rf node_modules/watchpack/node_modules/chokidar
$ npx run serve
... no more UnhandledPromiseRejectionWarning ...

I also tried node v10 and v14, but no dice: Still get the same UnhandledPromiseRejectionWarning

@alan-agius4
Copy link
Collaborator

@alan-agius4 alan-agius4 commented Jul 24, 2020

@vbraun, so I did try to replicate this again this time in a Linux container and I did manage to replicate it.

This will need some digging.

@ngbot ngbot bot added this to the Backlog milestone Jul 24, 2020
@vbraun
Copy link
Author

@vbraun vbraun commented Jul 24, 2020

This is probably paulmillr/chokidar#955

hupf added a commit to bkd-mba-fbi/absenzenmanagement that referenced this issue Sep 2, 2020
hupf added a commit to bkd-mba-fbi/absenzenmanagement that referenced this issue Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.