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

type error | Type 'FSWatcher' is missing the following properties from type 'FSWatcher': ref, unref #15714

Closed
7 tasks done
mhf-ir opened this issue Jan 25, 2024 · 15 comments · Fixed by tktcorporation/vrchat-join-recorder#64
Labels
bug: upstream Bug in a dependency of Vite pending triage

Comments

@mhf-ir
Copy link

mhf-ir commented Jan 25, 2024

Describe the bug

clone repo and npm install && npm run ci

current status:

https://github.com/mhf-ir/Node.js-TypeScript-Starter/actions/runs/7658137582/job/20870418679

Screenshot 2024-01-25 at 6 20 01 PM

Error: node_modules/vite/dist/node/index.d.ts(68,15): error TS2420: Class 'import("/home/runner/work/Node.js-TypeScript-Starter/Node.js-TypeScript-Starter/node_modules/vite/dist/node/index", { with: { "resolution-mode": "import" } }).FSWatcher' incorrectly implements interface 'import("fs").FSWatcher'.
Type 'FSWatcher' is missing the following properties from type 'FSWatcher': ref, unref
Error: Process completed with exit code 2.

Reproduction

https://github.com/mhf-ir/Node.js-TypeScript-Starter

Steps to reproduce

npm install && npm run ci

System Info

System:
    OS: Linux 6.2 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
    CPU: (4) x64 AMD EPYC 7763 64-Core Processor
    Memory: 14.59 GB / 15.61 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.11.0 - /opt/hostedtoolcache/node/20.11.0/x64/bin/node
    Yarn: 1.22.21 - /usr/local/bin/yarn
    npm: 10.2.4 - /opt/hostedtoolcache/node/20.11.0/x64/bin/npm
    pnpm: 8.14.3 - /usr/local/bin/pnpm
  Managers:
    Apt: 2.4.11 - /usr/bin/apt
    Cargo: 1.75.0 - ~/.cargo/bin/cargo
    Composer: 2.6.6 - /usr/bin/composer
    Gradle: 8.5 - /usr/bin/gradle
    Maven: 3.8.8 - /usr/bin/mvn
    pip3: 22.0.2 - /usr/bin/pip3
    RubyGems: 3.3.5 - /usr/bin/gem
  Utilities:
    Bazel: 7.0.1 - /usr/local/bin/bazel
    CMake: 3.28.1 - /usr/local/bin/cmake
    Make: 4.3 - /usr/bin/make
    GCC: 11.4.0 - /usr/bin/gcc
    Git: 2.43.0 - /usr/bin/git
    Clang: 14.0.0 - /usr/bin/clang
    Mercurial: 6.1.1 - /usr/bin/hg
    Subversion: 1.14.1 - /usr/bin/svn
    Curl: 7.81.0 - /usr/bin/curl
  Servers:
    Nginx: 1.18.0 - /usr/sbin/nginx
  Virtualization:
    Docker: 24.0.7 - /usr/bin/docker
  SDKs:
    Android SDK:
      API Levels: 31, 32, 33, 33, 33, 34, 34, 34
      Build Tools: 31.0.0, 32.0.0, 33.0.0, 33.0.1, 33.0.2, 34.0.0
      Android NDK: 25.2.9519653
  IDEs:
    Nano: 6.2 - /usr/bin/nano
    Vim: 8.2 - /usr/bin/vim
  Languages:
    Bash: 5.1.16 - /usr/bin/bash
    Go: 1.20.13 - /usr/bin/go
    Java: 11.0.21 - /usr/bin/javac
    Perl: 5.34.0 - /usr/bin/perl
    PHP: 8.1.2 - /usr/bin/php
    Python: 3.10.12 - /usr/bin/python
    Python3: 3.10.12 - /usr/bin/python3
    R: 4.3.2 - /usr/bin/R
    Ruby: 3.0.2 - /usr/bin/ruby
    Rust: 1.75.0 - /home/runner/.cargo/bin/rustc
  Databases:
    MySQL: 0.22.04.1 - /usr/bin/mysql
    SQLite: 3.37.2 - /usr/bin/sqlite3
  Browsers:
    Chrome: 120.0.6099.224
    Chromium: 120.0.6099.0

Used Package Manager

npm

Logs

Error: node_modules/vite/dist/node/index.d.ts(68,15): error TS2420: Class 'import("/home/runner/work/Node.js-TypeScript-Starter/Node.js-TypeScript-Starter/node_modules/vite/dist/node/index", { with: { "resolution-mode": "import" } }).FSWatcher' incorrectly implements interface 'import("fs").FSWatcher'.
Type 'FSWatcher' is missing the following properties from type 'FSWatcher': ref, unref
Error: Process completed with exit code 2.

Validations

@mhf-ir mhf-ir changed the title simple repo typescript and vite/vitest type error | Type 'FSWatcher' is missing the following properties from type 'FSWatcher': ref, unref Jan 25, 2024
@mhf-ir
Copy link
Author

mhf-ir commented Jan 25, 2024

adding these line will be solved the problem:

// node_modules/vite/dist/node/index.d.ts
declare class FSWatcher extends EventEmitter implements fs.FSWatcher {
  options: WatchOptions
  ref(): this; // <-- added
  unref(): this; // <-- added

@bdbvb
Copy link

bdbvb commented Jan 25, 2024

See also:

DefinitelyTyped/DefinitelyTyped#68300

for @types/node@20.11.6

@ghiscoding
Copy link
Contributor

it's being under investigation and discussion in PR #15706

@IgorIlgiyaev
Copy link

The same happens with vite 4.5.2 suddenly

@chaxus
Copy link
Contributor

chaxus commented Jan 26, 2024

tsconfig.json add "skipLibCheck": true

CGNonofr pushed a commit to CodinGame/monaco-vscode-api that referenced this issue Jan 26, 2024
Roman3349 added a commit to iqrf/iqrf-gateway-webapp that referenced this issue Jan 26, 2024
Signed-off-by: Roman Ondráček <mail@romanondracek.cz>
Upstream-Issue: vitejs/vite#15714
@pauliesnug
Copy link

I'm also having this issue, I cannot build my project due to it.

@IgorIlgiyaev
Copy link

"@types/node": "^18.19.9",

@IgorIlgiyaev
Copy link

tsconfig.json add "skipLibCheck": true

Didn't helped

@sapphi-red sapphi-red added the bug: upstream Bug in a dependency of Vite label Jan 28, 2024
jakesgordon added a commit to jakesgordon/tic-tac-toe that referenced this issue Jan 28, 2024
)

Added github actions to run test, lint, build on PR for main branch
> NOTE: temporarily skip build step during ci - there is an upstream bug that is still being investigated - vitejs/vite#15714
jakesgordon added a commit to jakesgordon/tic-tac-toe that referenced this issue Jan 28, 2024
jakesgordon added a commit to jakesgordon/tic-tac-toe that referenced this issue Jan 28, 2024
stefanvanherwijnen added a commit to simsustech/quasar-components that referenced this issue Feb 2, 2024
tktcorporation added a commit to tktcorporation/vrchat-join-recorder that referenced this issue Feb 4, 2024
niedzielski added a commit to oidoid/linear-text that referenced this issue Feb 5, 2024
hmsk added a commit to hmsk/vite-plugin-markdown that referenced this issue Feb 5, 2024
@huangjihua
Copy link

The same

@bluwy
Copy link
Member

bluwy commented Feb 8, 2024

This is already fixed in #15706 and released in 5.1 beta

@bluwy bluwy closed this as completed Feb 8, 2024
@IgorIlgiyaev
Copy link

and what about 4.5.2?

@mriehl
Copy link

mriehl commented Feb 8, 2024

It seems weird to close the issue when the latest non-beta version still doesn't work out of the box. Closed issues have less visibility, too, so this is bound to be a problem for beginners starting a new vite/ts project.

Is there a timeline for 5.1 already or something like "this week" / "this month"? I found the release cycle page but I don't know which case applies here.
Thanks for fixing the issue anyways!

@bluwy
Copy link
Member

bluwy commented Feb 8, 2024

We're releasing 5.1 stable today (if all goes well. worst case is next Monday). There aren't any plans to backport the fixes to v4 yet.

@ext
Copy link

ext commented Feb 11, 2024

Thank you for fixing this in the latest version!

There aren't any plans to backport the fixes to v4 yet.

As someone who cannot update to Vite 5 I still hope this fix will be backported to Vite 4 as well.

The major reasons for sticking to Vite 4 is that a library I'm writing still supports Node 16 (next breaking will drop support though) and for compatibility I still support Vite 4 and want to run tests against Vite 4 (which is tricky due to this issue).

As long as this issue is still present in Vite 4 the message I read is essentially that Vite 4 is dead and only the latest greatest is maintained properly.

@marchy
Copy link

marchy commented Feb 16, 2024

"@types/node": "^18.19.9",

Actually got introduced with Node 18.19.0. Latest 18.8.x works (ie: "@types/node": "~18.8.14")

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug: upstream Bug in a dependency of Vite pending triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.