question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Cannot find module '<projectDir>/node_modules/.pnpm/vite-plugin-checker@0.4.4_vite@2.8.6/node_modules/vite-plugin-checker/lib/checkers/vueTsc/typescript-vue-tsc/package.json'

See original GitHub issue

Describe the bug

When enabling vueTsc inside vite.config.ts by setting vueTsc: true, this error appears when running vite in dev-mode.

It appears, that a package.json is missing inside node_modules/vite-plugin-checker/lib/checkers/vueTsc/typescript-vue-tsc/

The issue was fixed by downgrading to v0.4.3

Reproduction

  1. Install vite-plugin-checker with pnpm
  2. set vueTsc: true inside vite.config.js
  3. run vite

Expected behavior

It should run without error.

System Info

System:
    OS: macOS 12.3
    CPU: (8) arm64 Apple M1
    Memory: 166.08 MB / 16.00 GB
    Shell: 5.8.1 - /opt/homebrew/bin/zsh
Binaries:
    Node: 16.14.0 - /usr/local/bin/node
    Yarn: 1.22.15 - /usr/local/bin/yarn
    npm: 8.5.5 - /usr/local/bin/npm
Browsers:
    Chrome: 99.0.4844.84
    Safari: 15.4
npmPackages:
    vite-plugin-checker: 0.4.4 => 0.4.4

Additional context

node:internal/event_target:916
  process.nextTick(() => { throw err; });
                           ^
Error: Cannot find module '<projectDir>/node_modules/.pnpm/vite-plugin-checker@0.4.4_vite@2.8.6/node_modules/vite-plugin-checker/lib/checkers/vueTsc/typescript-vue-tsc/package.json'
Require stack:
- <projectDir>/node_modules/.pnpm/vite-plugin-checker@0.4.4_vite@2.8.6/node_modules/vite-plugin-checker/lib/checkers/vueTsc/prepareVueTsc.js
- <projectDir>/node_modules/.pnpm/vite-plugin-checker@0.4.4_vite@2.8.6/node_modules/vite-plugin-checker/lib/checkers/vueTsc/main.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at prepareVueTsc (<projectDir>/node_modules/.pnpm/vite-plugin-checker@0.4.4_vite@2.8.6/node_modules/vite-plugin-checker/lib/checkers/vueTsc/prepareVueTsc.js:44:33)
    at Object.configureServer (<projectDir>/node_modules/.pnpm/vite-plugin-checker@0.4.4_vite@2.8.6/node_modules/vite-plugin-checker/lib/checkers/vueTsc/main.js:27:71)
    at MessagePort.<anonymous> (<projectDir>/node_modules/.pnpm/vite-plugin-checker@0.4.4_vite@2.8.6/node_modules/vite-plugin-checker/lib/worker.js:56:36)
    at MessagePort.[nodejs.internal.kHybridDispatch] (node:internal/event_target:647:20)
    at MessagePort.exports.emitMessage (node:internal/per_context/messageport:23:28)
Emitted 'error' event on Worker instance at:
    at Worker.[kOnErrorMessage] (node:internal/worker:289:10)
    at Worker.[kOnMessage] (node:internal/worker:300:37)
    at MessagePort.<anonymous> (node:internal/worker:201:57)
    at MessagePort.[nodejs.internal.kHybridDispatch] (node:internal/event_target:647:20)
    at MessagePort.exports.emitMessage (node:internal/per_context/messageport:23:28)
    at Worker.[kOnExit] (node:internal/worker:267:5)
    at Worker.<computed>.onexit (node:internal/worker:198:20) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '<projectDir>/node_modules/.pnpm/vite-plugin-checker@0.4.4_vite@2.8.6/node_modules/vite-plugin-checker/lib/checkers/vueTsc/prepareVueTsc.js',
    '<projectDir>/node_modules/.pnpm/vite-plugin-checker@0.4.4_vite@2.8.6/node_modules/vite-plugin-checker/lib/checkers/vueTsc/main.js'
  ]
}

Validations

  • Read the docs.
  • Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:22 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
eleven-net-cncommented, Dec 16, 2022
image

version: vite-plugin-checker@0.5.1 yarn v1.22.19 vite v3

When I install a new package, the folder of dist/cjs/checkers/vueTsc/typescript-vue-tsc will be removed automatically (the same as dist/esm/...), and then dev error.

And, retry to run start, the folder will be created again.

I tried to find the reason but couldn’t find it.

Error logs:

ERROR(vue-tsc)  File '/.../node_modules/vite-plugin-checker/dist/cjs/checkers/vueTsc/typescript-vue-tsc/lib/lib.dom.d.ts' not found.

@fi3ework

1reaction
Mioflycommented, Jun 16, 2022

Has this problem been solved

hello,Has this problem been solved

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find module 'node:path' in vite.config.ts · Issue #9113 ...
The error is Error: Cannot find module 'node:path' which seems to mean that the build isn't running in a node environment.
Read more >
6 - Stack Overflow
Error : Cannot find module '../../package.json' · Subscribe to RSS.
Read more >
Troubleshooting - Vite
Error : Cannot find module 'C:\foo\bar&baz\vite\bin\vite.js' #. The path to your project folder may include & , which doesn't work with npm on...
Read more >
cannot find module 'vite' or its corresponding type declarations
To solve the "Cannot find module `path` or its corresponding type declarations" error, install the types for node by running the command `npm...
Read more >
package.json issue while deploying a node api on Azure App ...
The Github Actions part works fine, but the website doesn't work, and when I look in the logs, it shows this error :...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found