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

bug: watch mode crashes on git operations (ERR_INVALID_ARG_TYPE) #4044

Closed
3 tasks done
cscorley opened this issue Feb 9, 2023 · 8 comments · Fixed by #4146
Closed
3 tasks done

bug: watch mode crashes on git operations (ERR_INVALID_ARG_TYPE) #4044

cscorley opened this issue Feb 9, 2023 · 8 comments · Fixed by #4146
Assignees
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil

Comments

@cscorley
Copy link

cscorley commented Feb 9, 2023

Prerequisites

Stencil Version

3.0.0

Current Behavior

stencil build --dev --watch --serve crashes whenever a git operation is performed on stencil-watched files

Expected Behavior

Components are re-built without crashing.

System Info

macOS Ventura 13.2 (22D49)
node v16.18.1
npm 8.19.2

Steps to Reproduce

Steps to exact the behavior I am seeing:

  1. Initialize the repository with npm init stencil
  2. Choose "component" and proceed with rest of setup
  3. Run npm install
  4. Check-in all the files
  5. Run npm start
  6. Make some edits to my-component.tsx, save, and observe the watcher completes the re-compilation.
  7. In VS Code, or git CLI, discard the changes to that file or the branch (e.g. git reset --hard HEAD).

Code Reproduction URL

https://github.com/cscorley/stencil-minimum

Additional Information

This is also occurring on v2.22.1.

Other git ops known to work include any thing that affects any file which is stencil-relevant: changing branches, merging branches, fast-forwarding, pulling, and so on.

Stack of the crash:

[03:49.8]  rebuild finished, watching for changes... in 176 ms

node:internal/validators:139
    throw new ERR_INVALID_ARG_TYPE(name, 'number', value);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "interval" argument must be of type number. Received undefined
    at StatWatcher.<computed> (node:internal/fs/watchers:116:3)
    at Object.watchFile (node:fs:2361:39)
    at pollingWatchFileWorker (/Users/cscorley/git/stencil-minimum/node_modules/@stencil/core/compiler/stencil.js:57:128598)
    at /Users/cscorley/git/stencil-minimum/node_modules/@stencil/core/compiler/stencil.js:57:125936
    at d (/Users/cscorley/git/stencil-minimum/node_modules/@stencil/core/compiler/stencil.js:57:118297)
    at B (/Users/cscorley/git/stencil-minimum/node_modules/@stencil/core/compiler/stencil.js:57:125906)
    at I (/Users/cscorley/git/stencil-minimum/node_modules/@stencil/core/compiler/stencil.js:57:123551)
    at v (/Users/cscorley/git/stencil-minimum/node_modules/@stencil/core/compiler/stencil.js:57:127034)
    at d (/Users/cscorley/git/stencil-minimum/node_modules/@stencil/core/compiler/stencil.js:57:126353)
    at FSWatcher.f (/Users/cscorley/git/stencil-minimum/node_modules/@stencil/core/compiler/stencil.js:57:126823) {
  code: 'ERR_INVALID_ARG_TYPE'
}
@ionitron-bot ionitron-bot bot added the triage label Feb 9, 2023
@rwaskiewicz rwaskiewicz self-assigned this Feb 9, 2023
@rwaskiewicz
Copy link
Contributor

Hey @cscorley 👋

Thanks for the detailed bug report! I was able to reproduce this locally, and am going to label this to be ingested into our backlog.

Note to team: potentially related to #3952

@rwaskiewicz rwaskiewicz added the Bug: Validated This PR or Issue is verified to be a bug within Stencil label Feb 9, 2023
@ionitron-bot ionitron-bot bot removed the triage label Feb 9, 2023
@cscorley
Copy link
Author

To add to the report, I was not able to reproduce on Linux (NixOS with repository flake, node 16.18.1, npm 8.19.2). I believe it is limited to MacOS. This also affects my coworkers on their MacOS machines (with node installed via brew, rather than Nix.)

@maxrrv
Copy link

maxrrv commented Feb 16, 2023

Hello :)
One more addition to this issue: This also happens on changes to a file. Whenever a write to a watched file happens, the same error as mentioned above occurs and the process crashes.

System info:

npm version: 8.19.3
node version: v16.19.0 (installed via fnm)
device: MacBook Pro (13-inch, M2, 2022)
OS: 12.6.3 (21G419)

@George-Payne
Copy link
Contributor

I was not able to reproduce on Linux

I've been getting the error on linux, on deleting / moving files.

[24:17.5]  rebuild failed, watching for changes... in 10ms
node:internal/validators:140
    throw new ERR_INVALID_ARG_TYPE(name, 'number', value);
    ^
TypeError [ERR_INVALID_ARG_TYPE]: The "interval" argument must be of type number. Received undefined
    at StatWatcher.<computed> (node:internal/fs/watchers:116:3)

System info:

kernel: x86_64 Linux 6.1.11-arch1-1
node version: v18.12.1
npm version: 8.19.2

@rwaskiewicz rwaskiewicz removed their assignment Feb 17, 2023
@sean-perkins
Copy link
Contributor

I'm able to reproduce this consistently on Ionic Framework as well. I'm using MacOS, but I assume this is a result of the Typescript 4.8 upgrade, which had changes to both Linux and MacOS file watching.

After running the dev server, deleting a static file, such as a .png file in our src/ directory (e.g. our visual regression pngs), results in the exception:

node:internal/validators:104
      throw new ERR_INVALID_ARG_TYPE(name, 'number', value);
      ^

TypeError [ERR_INVALID_ARG_TYPE]: The "interval" argument must be of type number. Received undefined
    at StatWatcher.<computed> (node:internal/fs/watchers:116:3)
    at Object.watchFile (node:fs:2329:39)
    at pollingWatchFileWorker (/Users/sean/Documents/ionic/framework-next/core/node_modules/@stencil/core/compiler/stencil.js:57:128598)
    at /Users/sean/Documents/ionic/framework-next/core/node_modules/@stencil/core/compiler/stencil.js:57:125936
    at d (/Users/sean/Documents/ionic/framework-next/core/node_modules/@stencil/core/compiler/stencil.js:57:118297)
    at B (/Users/sean/Documents/ionic/framework-next/core/node_modules/@stencil/core/compiler/stencil.js:57:125906)
    at I (/Users/sean/Documents/ionic/framework-next/core/node_modules/@stencil/core/compiler/stencil.js:57:123551)
    at v (/Users/sean/Documents/ionic/framework-next/core/node_modules/@stencil/core/compiler/stencil.js:57:127034)
    at d (/Users/sean/Documents/ionic/framework-next/core/node_modules/@stencil/core/compiler/stencil.js:57:126353)
    at FSWatcher.f (/Users/sean/Documents/ionic/framework-next/core/node_modules/@stencil/core/compiler/stencil.js:57:126823) {
  code: 'ERR_INVALID_ARG_TYPE'
}

@rwaskiewicz rwaskiewicz self-assigned this Mar 9, 2023
@rwaskiewicz
Copy link
Contributor

Hey folks 👋

I have two dev builds of Stencil that may fix this issue, one for Stencil v2 users, and one for Stencil v3 users. If anyone running into this particular issue could install either version (if you're on Stencil v2.X, use the first one. if you're on Stencil v3.X, use the second one) and report back as to whether that fixes the issue at hand, that be much appreciated.

  • npm i @stencil/core@2.22.2-dev.1678485833.33567aa OR
  • npm i @stencil/core@3.1.0-dev.1678485791.d8115c8

Thanks!

@cscorley
Copy link
Author

Both of these seem to work for me! This also seems like it resolves #3952 (though I only run into that one sporadically)

@rwaskiewicz
Copy link
Contributor

The PR associated with this issue has landed and is included in today's v2.22.3 release and v3.2.0 release. As a result, I'm going to close this issue. Should this issue reappear, please feel free to open a new issue. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants