vite-plugin-checker
vite-plugin-checker copied to clipboard
Error: Cannot find module '<projectDir>/node_modules/.pnpm/[email protected][email protected]/node_modules/vite-plugin-checker/lib/checkers/vueTsc/typescript-vue-tsc/package.json'
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
- Install
vite-plugin-checker
withpnpm
- set
vueTsc: true
insidevite.config.js
- 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/[email protected][email protected]/node_modules/vite-plugin-checker/lib/checkers/vueTsc/typescript-vue-tsc/package.json'
Require stack:
- <projectDir>/node_modules/.pnpm/[email protected][email protected]/node_modules/vite-plugin-checker/lib/checkers/vueTsc/prepareVueTsc.js
- <projectDir>/node_modules/.pnpm/[email protected][email protected]/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/[email protected][email protected]/node_modules/vite-plugin-checker/lib/checkers/vueTsc/prepareVueTsc.js:44:33)
at Object.configureServer (<projectDir>/node_modules/.pnpm/[email protected][email protected]/node_modules/vite-plugin-checker/lib/checkers/vueTsc/main.js:27:71)
at MessagePort.<anonymous> (<projectDir>/node_modules/.pnpm/[email protected][email protected]/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/[email protected][email protected]/node_modules/vite-plugin-checker/lib/checkers/vueTsc/prepareVueTsc.js',
'<projectDir>/node_modules/.pnpm/[email protected][email protected]/node_modules/vite-plugin-checker/lib/checkers/vueTsc/main.js'
]
}
Validations
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Try deleting node_modules
and pnpm i
again. Does it work? Did you disabled hoist
of pnpm in npmrc?
I already tried that. I also didn't change the default pnpm settings.
Would you like to paste your package.json
Issue was fixed with (probably) version 0.4.5 👍
I still get this issue on 0.4.6
node:internal/event_target:916
process.nextTick(() => { throw err; });
^
Error: Cannot find module 'C:\Git\BlocPlatform\Bloc\Frontend\Bloc.Vue\node_modules\.pnpm\[email protected][email protected]\node_modules\vite-plugin-checker\lib\checkers\vueTsc\typescript-vue-tsc\package.json'
Require stack:
- C:\Git\BlocPlatform\Bloc\Frontend\Bloc.Vue\node_modules\.pnpm\[email protected][email protected]\node_modules\vite-plugin-checker\lib\checkers\vueTsc\prepareVueTsc.js
- C:\Git\BlocPlatform\Bloc\Frontend\Bloc.Vue\node_modules\.pnpm\[email protected][email protected]\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 (C:\Git\BlocPlatform\Bloc\Frontend\Bloc.Vue\node_modules\.pnpm\[email protected][email protected]\node_modules\vite-plugin-checker\lib\checkers\vueTsc\prepareVueTsc.js:61:29)
at Object.configureServer (C:\Git\BlocPlatform\Bloc\Frontend\Bloc.Vue\node_modules\.pnpm\[email protected][email protected]\node_modules\vite-plugin-checker\lib\checkers\vueTsc\main.js:46:70)
at MessagePort.<anonymous> (C:\Git\BlocPlatform\Bloc\Frontend\Bloc.Vue\node_modules\.pnpm\[email protected][email protected]\node_modules\vite-plugin-checker\lib\worker.js:75:24)
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: [
'C:\\Git\\BlocPlatform\\Bloc\\Frontend\\Bloc.Vue\\node_modules\\.pnpm\\[email protected][email protected]\\node_modules\\vite-plugin-checker\\lib\\checkers\\vueTsc\\prepareVueTsc.js',
'C:\\Git\\BlocPlatform\\Bloc\\Frontend\\Bloc.Vue\\node_modules\\.pnpm\\[email protected][email protected]\\node_modules\\vite-plugin-checker\\lib\\checkers\\vueTsc\\main.js'
]
}
The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command npm run dev" terminated with exit code: 1.
I still get this issue on 0.4.6
node:internal/event_target:916 process.nextTick(() => { throw err; }); ^ Error: Cannot find module 'C:\Git\BlocPlatform\Bloc\Frontend\Bloc.Vue\node_modules\.pnpm\[email protected][email protected]\node_modules\vite-plugin-checker\lib\checkers\vueTsc\typescript-vue-tsc\package.json' Require stack: - C:\Git\BlocPlatform\Bloc\Frontend\Bloc.Vue\node_modules\.pnpm\[email protected][email protected]\node_modules\vite-plugin-checker\lib\checkers\vueTsc\prepareVueTsc.js - C:\Git\BlocPlatform\Bloc\Frontend\Bloc.Vue\node_modules\.pnpm\[email protected][email protected]\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 (C:\Git\BlocPlatform\Bloc\Frontend\Bloc.Vue\node_modules\.pnpm\[email protected][email protected]\node_modules\vite-plugin-checker\lib\checkers\vueTsc\prepareVueTsc.js:61:29) at Object.configureServer (C:\Git\BlocPlatform\Bloc\Frontend\Bloc.Vue\node_modules\.pnpm\[email protected][email protected]\node_modules\vite-plugin-checker\lib\checkers\vueTsc\main.js:46:70) at MessagePort.<anonymous> (C:\Git\BlocPlatform\Bloc\Frontend\Bloc.Vue\node_modules\.pnpm\[email protected][email protected]\node_modules\vite-plugin-checker\lib\worker.js:75:24) 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: [ 'C:\\Git\\BlocPlatform\\Bloc\\Frontend\\Bloc.Vue\\node_modules\\.pnpm\\[email protected][email protected]\\node_modules\\vite-plugin-checker\\lib\\checkers\\vueTsc\\prepareVueTsc.js', 'C:\\Git\\BlocPlatform\\Bloc\\Frontend\\Bloc.Vue\\node_modules\\.pnpm\\[email protected][email protected]\\node_modules\\vite-plugin-checker\\lib\\checkers\\vueTsc\\main.js' ] } The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command npm run dev" terminated with exit code: 1.
Me too...
I could fix this issue by running pnpm store prune
or manually deleting the whole pnpm store in pnpm store path
and reinstalling the dependencies with pnpm install
.
It's very weird, because 1 hour ago everything was ok.
I think a pnpm install
in a different repo somehow deleted the package.json
inside typescript-vue-tsc
in my local pnpm store... So it seems to be an issue with pnpm
?
Has this problem been solved
Has this problem been solved
hello,Has this problem been solved
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is a bug report, please provide a minimal re-production repository or use path to reproduce. Thank you for your contributions.
Can confirm this is still an issue
I can also confirm this is still an issue. I made a fresh project with create-vue to test out this plugin, enabled the vueTsc option and immediately got the same error as everyone else.
Vite config
import { fileURLToPath, URL } from 'node:url';
import vue from '@vitejs/plugin-vue';
import { defineConfig } from 'vite';
import checker from 'vite-plugin-checker';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
checker({
vueTsc: true,
}),
vue(),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
});
Stack trace
node:internal/event_target:964
process.nextTick(() => { throw err; });
^
Error: Cannot find module '/Users/benwebb/code/create-vue-test/node_modules/vite-plugin-checker/lib/checkers/vueTsc/typescript-vue-tsc/package.json'
Require stack:
- /Users/benwebb/code/create-vue-test/node_modules/vite-plugin-checker/lib/checkers/vueTsc/prepareVueTsc.js
- /Users/benwebb/code/create-vue-test/node_modules/vite-plugin-checker/lib/checkers/vueTsc/main.js
at Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
at Module._load (node:internal/modules/cjs/loader:804:27)
at Module.require (node:internal/modules/cjs/loader:1022:19)
at require (node:internal/modules/cjs/helpers:102:18)
at prepareVueTsc (/Users/benwebb/code/create-vue-test/node_modules/vite-plugin-checker/lib/checkers/vueTsc/prepareVueTsc.js:61:29)
at Object.configureServer (/Users/benwebb/code/create-vue-test/node_modules/vite-plugin-checker/lib/checkers/vueTsc/main.js:46:70)
at MessagePort.<anonymous> (/Users/benwebb/code/create-vue-test/node_modules/vite-plugin-checker/lib/worker.js:75:24)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:689:20)
at exports.emitMessage (node:internal/per_context/messageport:23:28)
Emitted 'error' event on Worker instance at:
at [kOnErrorMessage] (node:internal/worker:290:10)
at [kOnMessage] (node:internal/worker:301:37)
at MessagePort.<anonymous> (node:internal/worker:202:57)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:689:20)
at exports.emitMessage (node:internal/per_context/messageport:23:28)
at [kOnExit] (node:internal/worker:268:5)
at Worker.<computed>.onexit (node:internal/worker:199:20) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/benwebb/code/create-vue-test/node_modules/vite-plugin-checker/lib/checkers/vueTsc/prepareVueTsc.js',
'/Users/benwebb/code/create-vue-test/node_modules/vite-plugin-checker/lib/checkers/vueTsc/main.js'
]
}
Deleting node modules and reinstalling as described by @DrJume does seem to resolve the issue. Strange.
I think it basically fails to put the package.json in the directory. A first install worked, maybe the (pnpm) upgrade sometimes deletes the package.json?
Does this issue still exists after 0.5.0? Although I'm not very clearly what cause the issue, but I added a try catch statement to prevent this.
https://github.com/fi3ework/vite-plugin-checker/blob/140f96c3d24f70e118e8397fc23aa7e41e01ee91/packages/vite-plugin-checker/src/checkers/vueTsc/prepareVueTsc.ts#L53-L66
I think it should be fixed in 0.5.0 from latest response in https://github.com/fi3ework/vite-plugin-checker/issues/137
I think it should be fixed in 0.5.0 from latest response in #137
Still getting similar error in 0.5.1
Error: EROFS: read-only filesystem, mkdir '/node_modules/vite-plugin-checker/dist/cjs/checkers/vueTsc/typescript-vue-tsc'
Same here on 0.5.2 when using stylelint
node:internal/event_target:969
process.nextTick(() => { throw err; });
^
TypeError [Error]: (0 , import_options.default) is not a function
at Object.configureServer (/.../node_modules/.pnpm/[email protected]/node_modules/vite-plugin-checker/dist/cjs/checkers/stylelint/main.js:58:60)
at MessagePort.<anonymous> (/.../node_modules/.pnpm/[email protected]/node_modules/vite-plugin-checker/dist/cjs/worker.js:80:26)
at MessagePort.[nodejs.internal.kHybridDispatch] (node:internal/event_target:694: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:290:10)
at Worker.[kOnMessage] (node:internal/worker:301:37)
at MessagePort.<anonymous> (node:internal/worker:202:57)
at MessagePort.[nodejs.internal.kHybridDispatch] (node:internal/event_target:694:20)
at MessagePort.exports.emitMessage (node:internal/per_context/messageport:23:28)
The mentioned import refers to options.js
, but that file does exist, so it's the problem isn't clear
@IlCallo This seems like not the same issue in this thread but related to https://github.com/fi3ework/vite-plugin-checker/issues/184 as the default export is not found in CJS mode. Let's track in that issue and would like to provide a minimal re-pro?

version: [email protected] 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
This seems like not the same issue in this thread but related to https://github.com/fi3ework/vite-plugin-checker/issues/184
I ignored that one since I'm using Vite 2, while that's about Vite 3 I'm gonna create a repro, I think the problem may related to the monorepo structure of my project
VITE v4.0.4 ready in 633 ms
➜ Local: http://localhost:8000/
➜ Network: http://192.168.1.6:8000/
➜ press h to show help
node:internal/event_target:1013
process.nextTick(() => { throw err; });
^
Error: start < 0
at createTextSpan (/Users/dan/example/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:12547:19)
at Object.createTextSpanFromBounds (/Users/dan/example/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:12556:16)
at getErrorSpanForNode (/Users/dan/example/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:15597:19)
at Object.createDiagnosticForNodeFromMessageChain (/Users/dan/example/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:15462:20)
at resolveExternalModule (/Users/dan/example/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:52379:52)
at resolveExternalModuleNameWorker (/Users/dan/example/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:52301:19)
at resolveExternalModuleName (/Users/dan/example/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:52296:20)
at getSymbolAtLocation (/Users/dan/example/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:88409:32)
at Object.getSymbolAtLocation (/Users/dan/example/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:49394:31)
at getReferencedFilesFromImportLiteral (/Users/dan/example/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js:122348:34)
Emitted 'error' event on Worker instance at:
at [kOnErrorMessage] (node:internal/worker:300:10)
at [kOnMessage] (node:internal/worker:311:37)
at MessagePort.<anonymous> (node:internal/worker:207:57)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:738:20)
at exports.emitMessage (node:internal/per_context/messageport:23:28)
Node.js v19.3.0
works for me when you add pnpm add vue-tsc@latest typescript vite-plugin-checker -D
(monorepo case)
@isabolic Which re-produce method or solution works for you? 🤔
@fi3ework I had a exact error, so I run
-
rm -rf node_modules
-
pnpm install
-
pnpm add --filter MONOREPO_PCK_OR_APP vue-tsc typescript vite-plugin-checker -D
now pnpm dev
has no errors
@isabolic Which version of the plugin you're using?
@fi3ework issue still present after double check... sorry about that :)
Error: EEXIST: file already exists, mkdir
I think this is monorepo case, if i go into packages/ui-components
and run pnpm dev
/vite dev
and go back to root repo directory and after that I run pnpm dev
works fine... But after you add new package or update to latest the same error appears..