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

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

About this issue

  • Original URL
  • State: closed
  • Created 5 months ago
  • Reactions: 5
  • Comments: 15 (4 by maintainers)

Commits related to this issue

Most upvoted comments

tsconfig.json add “skipLibCheck”: true

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.

This is already fixed in https://github.com/vitejs/vite/pull/15706 and released in 5.1 beta