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

Closed
1 of 15 tasks
vbraun opened this issue Jul 23, 2020 · 8 comments
Closed
1 of 15 tasks

Emacs lock files cause an UnhandledPromiseRejectionWarning in ng serve #18342

vbraun opened this issue Jul 23, 2020 · 8 comments

Comments

@vbraun
Copy link

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
@alan-agius4 alan-agius4 added the needs: more info Reporter must clarify the issue label Jul 23, 2020
@vbraun
Copy link
Author

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 alan-agius4 added area: ngtools/webpack freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix and removed needs: more info Reporter must clarify the issue labels Jul 23, 2020
@ngbot ngbot bot modified the milestone: Backlog Jul 23, 2020
@alan-agius4 alan-agius4 removed area: ngtools/webpack freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix labels Jul 23, 2020
@ngbot ngbot bot modified the milestone: Backlog Jul 23, 2020
@alan-agius4
Copy link
Collaborator

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

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

@alan-agius4 alan-agius4 added freq1: low Only reported by a handful of users who observe it rarely needs: investigation Requires some digging to determine if action is needed severity3: broken area: devkit/build-angular labels Jul 24, 2020
@ngbot ngbot bot added this to the needsTriage milestone Jul 24, 2020
@ngbot ngbot bot removed this from the needsTriage milestone Jul 24, 2020
@ngbot ngbot bot added this to the Backlog milestone Jul 24, 2020
@vbraun
Copy link
Author

vbraun commented Jul 24, 2020

This is probably paulmillr/chokidar#955

@alan-agius4 alan-agius4 added state: blocked on upstream devkit/build-angular:dev-server and removed needs: investigation Requires some digging to determine if action is needed labels Jul 24, 2020
hupf added a commit to bkd-mba-fbi/webapp-schulverwaltung that referenced this issue Sep 2, 2020
hupf added a commit to bkd-mba-fbi/webapp-schulverwaltung that referenced this issue Sep 8, 2020
@glihm
Copy link

glihm commented Jan 7, 2021

Exactly the same here, a temporal solution waiting the release might be to add this line in .emacs file:

(setq create-lockfiles nil)

But this solution should only be temporary and/or rely on more often backup files.

@alan-agius4
Copy link
Collaborator

Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Angular CLI version.

If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jul 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants