Failed to resolve entry for package "@sveltejs/package".
Describe the bug
See the video! The error happens when update to latest version (0.34.1).
https://github.com/vitest-dev/vitest/assets/130963/4d1bd2fa-bcde-4adf-ae5b-cf6440d73d16
Reproduction
I don't know if it's just a sveltekit problem.
To get the error, update vitest to latest version (0.34.1).
Example:
| status | version | url |
|---|---|---|
| Error | 0.34.1 | https://stackblitz.com/edit/sveltejs-kit-template-default-5ewdfa?file=package.json |
| Ok | 0.33.0 | https://stackblitz.com/edit/sveltejs-kit-template-default-l1xw6t?file=package.json |
Open the link and run:
npm test
System Info
System:
OS: macOS 13.3.1
CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
Memory: 628.38 MB / 32.00 GB
Shell: 3.5.1 - /usr/local/bin/fish
Binaries:
Node: 18.16.0 - /usr/local/bin/node
Yarn: 1.22.19 - ~/.npm-global/bin/yarn
npm: 9.7.1 - ~/.npm-global/bin/npm
pnpm: 8.6.0 - ~/.npm-global/bin/pnpm
Browsers:
Chrome: 115.0.5790.170
Chrome Canary: 117.0.5928.0
Safari: 16.4
### Used Package Manager
pnpm
### Validations
- [X] Follow our [Code of Conduct](https://github.com/vitest-dev/vitest/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guidelines](https://github.com/vitest-dev/vitest/blob/main/CONTRIBUTING.md).
- [X] Read the [docs](https://vitest.dev/guide/).
- [X] Check that there isn't [already an issue](https://github.com/vitest-dev/vitest/issues) that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vitest-dev/vitest/discussions) or join our [Discord Chat Server](https://chat.vitest.dev).
- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
Hello @lagden. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with need reproduction will be closed if they have no activity within 3 days.
Start a new pull request in StackBlitz Codeflow.
This is the solution that worked out for me: https://github.com/sveltejs/vite-plugin-svelte/issues/710#issuecomment-1672661958
i.e. bumping @sveltejs/vite-plugin-svelte
I just found the same issue.
After upgrading from vitest 0.34.3 to 0.34.6 I can't run unit tests and end up with my laptop sounding like it's going to take off. There seems to be a Node process that is stuck and consuming over 100% CPU.
I confirmed this by going back to 0.34.3 and running the tests. All fine.
When I upgrade to 0.34.4 the bug occurs but the first time I get a helpful error message (I hope it's helpful)
Toggle to view full error log
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Error: Failed to resolve entry for package "@sveltejs/package". The package may have incorrect main/module/exports specified in its package.json: No known conditions for "." specifier in "@sveltejs/package" package
❯ packageEntryFailure node_modules/vite/dist/node/chunks/dep-bb8a8339.js:28725:11
❯ resolvePackageEntry node_modules/vite/dist/node/chunks/dep-bb8a8339.js:28720:9
❯ tryNodeResolve node_modules/vite/dist/node/chunks/dep-bb8a8339.js:28453:20
❯ Context.resolveId node_modules/vite/dist/node/chunks/dep-bb8a8339.js:28212:28
❯ Object.resolveId node_modules/vite/dist/node/chunks/dep-bb8a8339.js:44276:64
❯ async file:/Users/project/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:65922:21
❯ async file:/Users/project/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:44925:20
❯ addManuallyIncludedOptimizeDeps node_modules/vite/dist/node/chunks/dep-bb8a8339.js:46108:31
❯ optimizeServerSsrDeps node_modules/vite/dist/node/chunks/dep-bb8a8339.js:45712:5
❯ createDevSsrDepsOptimizer node_modules/vite/dist/node/chunks/dep-bb8a8339.js:45630:22
project % fatal error: all goroutines are asleep - deadlock!
goroutine 1 [chan receive]:
github.com/evanw/esbuild/internal/helpers.(*ThreadSafeWaitGroup).Wait(...)
github.com/evanw/esbuild/internal/helpers/waitgroup.go:36
main.runService.func2()
github.com/evanw/esbuild/cmd/esbuild/service.go:114 +0x59
main.runService(0x1)
github.com/evanw/esbuild/cmd/esbuild/service.go:160 +0x4ed
main.main()
github.com/evanw/esbuild/cmd/esbuild/main.go:240 +0xa29
goroutine 18 [chan receive]:
main.runService.func1()
github.com/evanw/esbuild/cmd/esbuild/service.go:98 +0x4a
created by main.runService
github.com/evanw/esbuild/cmd/esbuild/service.go:97 +0x1e5
goroutine 19 [chan receive]:
main.(*serviceType).sendRequest(0xc000099ef0, {0x150edc0, 0xc000099e00})
github.com/evanw/esbuild/cmd/esbuild/service.go:192 +0xfa
main.runService.func3()
github.com/evanw/esbuild/cmd/esbuild/service.go:125 +0x39
created by main.runService
github.com/evanw/esbuild/cmd/esbuild/service.go:122 +0x31c
goroutine 54 [semacquire]:
sync.runtime_Semacquire(0xc000211ac0?)
runtime/sema.go:62 +0x27
sync.(*WaitGroup).Wait(0x1539b40?)
sync/waitgroup.go:116 +0x4b
github.com/evanw/esbuild/internal/bundler.(*scanner).addEntryPoints(0xc000281680, {0xc000174120, 0x7, 0x1667ad8?})
github.com/evanw/esbuild/internal/bundler/bundler.go:1692 +0xe52
github.com/evanw/esbuild/internal/bundler.ScanBundle(_, {_, _, _, _, _, _}, {_, _}, 0xc0000ae480, ...)
github.com/evanw/esbuild/internal/bundler/bundler.go:1253 +0xaee
github.com/evanw/esbuild/pkg/api.rebuildImpl({0xc0000ae480, {0xc0000a04c8, 0x1, 0x1}, {0x0, 0x0, 0x0}, {0x0, 0x1, 0x2, ...}, ...}, ...)
github.com/evanw/esbuild/pkg/api/api_impl.go:1495 +0x305
github.com/evanw/esbuild/pkg/api.(*internalContext).rebuild(_)
github.com/evanw/esbuild/pkg/api/api_impl.go:1024 +0x28c
github.com/evanw/esbuild/pkg/api.(*internalContext).Rebuild(0xc000125900?)
github.com/evanw/esbuild/pkg/api/api_impl.go:1085 +0x58
main.(*serviceType).handleIncomingPacket.func5()
github.com/evanw/esbuild/cmd/esbuild/service.go:293 +0xd5
created by main.(*serviceType).handleIncomingPacket
github.com/evanw/esbuild/cmd/esbuild/service.go:290 +0x118d
goroutine 57 [chan send]:
github.com/evanw/esbuild/internal/bundler.ScanBundle.func2()
github.com/evanw/esbuild/internal/bundler/bundler.go:1193 +0x2c5
created by github.com/evanw/esbuild/internal/bundler.ScanBundle
github.com/evanw/esbuild/internal/bundler/bundler.go:1191 +0x93b
goroutine 16 [chan receive]:
main.(*serviceType).sendRequest(0xc000099ef0, {0x150edc0, 0xc00026b7d0})
github.com/evanw/esbuild/cmd/esbuild/service.go:192 +0xfa
main.(*serviceType).convertPlugins.func2.3({{0xc0004369c0, 0xf}, {0x0, 0x0}, {0x0, 0x0}, {0xc0003e2440, 0x36}, 0x1, {0x0, ...}})
github.com/evanw/esbuild/cmd/esbuild/service.go:969 +0x785
github.com/evanw/esbuild/pkg/api.(*pluginImpl).onResolve.func1({{0xc0004369c0, 0xf}, {0xc0003e2440, 0x36}, {0x0, 0x0}, {{0x0, 0x0}, {0x0, 0x0}, ...}, ...})
github.com/evanw/esbuild/pkg/api/api_impl.go:1920 +0x215
github.com/evanw/esbuild/internal/bundler.RunOnResolvePlugins({_, _, _}, _, {0xc00047e1c0, 0xc00047c498, 0xc00047c4b0, 0xc0004173e0, 0x5, 0xc00012e7b0}, ...)
github.com/evanw/esbuild/internal/bundler/bundler.go:828 +0x8d5
github.com/evanw/esbuild/internal/bundler.(*scanner).addEntryPoints.func1(0x0, {{0xc0004369c0, 0xf}, {0x0, 0x0}, 0x0})
github.com/evanw/esbuild/internal/bundler/bundler.go:1650 +0x205
created by github.com/evanw/esbuild/internal/bundler.(*scanner).addEntryPoints
github.com/evanw/esbuild/internal/bundler/bundler.go:1643 +0xc3a
goroutine 65 [chan receive]:
main.(*serviceType).sendRequest(0xc000099ef0, {0x150edc0, 0xc00026b800})
github.com/evanw/esbuild/cmd/esbuild/service.go:192 +0xfa
main.(*serviceType).convertPlugins.func2.3({{0xc0004369d0, 0xd}, {0x0, 0x0}, {0x0, 0x0}, {0xc0003e2440, 0x36}, 0x1, {0x0, ...}})
github.com/evanw/esbuild/cmd/esbuild/service.go:969 +0x785
github.com/evanw/esbuild/pkg/api.(*pluginImpl).onResolve.func1({{0xc0004369d0, 0xd}, {0xc0003e2440, 0x36}, {0x0, 0x0}, {{0x0, 0x0}, {0x0, 0x0}, ...}, ...})
github.com/evanw/esbuild/pkg/api/api_impl.go:1920 +0x215
github.com/evanw/esbuild/internal/bundler.RunOnResolvePlugins({_, _, _}, _, {0xc00047e1c0, 0xc00047c498, 0xc00047c4b0, 0xc0004173e0, 0x5, 0xc00012e7b0}, ...)
github.com/evanw/esbuild/internal/bundler/bundler.go:828 +0x8d5
github.com/evanw/esbuild/internal/bundler.(*scanner).addEntryPoints.func1(0x1, {{0xc0004369d0, 0xd}, {0x0, 0x0}, 0x0})
github.com/evanw/esbuild/internal/bundler/bundler.go:1650 +0x205
created by github.com/evanw/esbuild/internal/bundler.(*scanner).addEntryPoints
github.com/evanw/esbuild/internal/bundler/bundler.go:1643 +0xc3a
goroutine 66 [chan receive]:
main.(*serviceType).sendRequest(0xc000099ef0, {0x150edc0, 0xc00026b830})
github.com/evanw/esbuild/cmd/esbuild/service.go:192 +0xfa
main.(*serviceType).convertPlugins.func2.3({{0xc0003ce768, 0x11}, {0x0, 0x0}, {0x0, 0x0}, {0xc0003e2440, 0x36}, 0x1, {0x0, ...}})
github.com/evanw/esbuild/cmd/esbuild/service.go:969 +0x785
github.com/evanw/esbuild/pkg/api.(*pluginImpl).onResolve.func1({{0xc0003ce768, 0x11}, {0xc0003e2440, 0x36}, {0x0, 0x0}, {{0x0, 0x0}, {0x0, 0x0}, ...}, ...})
github.com/evanw/esbuild/pkg/api/api_impl.go:1920 +0x215
github.com/evanw/esbuild/internal/bundler.RunOnResolvePlugins({_, _, _}, _, {0xc00047e1c0, 0xc00047c498, 0xc00047c4b0, 0xc0004173e0, 0x5, 0xc00012e7b0}, ...)
github.com/evanw/esbuild/internal/bundler/bundler.go:828 +0x8d5
github.com/evanw/esbuild/internal/bundler.(*scanner).addEntryPoints.func1(0x2, {{0xc0003ce768, 0x11}, {0x0, 0x0}, 0x0})
github.com/evanw/esbuild/internal/bundler/bundler.go:1650 +0x205
created by github.com/evanw/esbuild/internal/bundler.(*scanner).addEntryPoints
github.com/evanw/esbuild/internal/bundler/bundler.go:1643 +0xc3a
goroutine 67 [chan receive]:
main.(*serviceType).sendRequest(0xc000099ef0, {0x150edc0, 0xc00026b860})
github.com/evanw/esbuild/cmd/esbuild/service.go:192 +0xfa
main.(*serviceType).convertPlugins.func2.3({{0xc0004369e0, 0xe}, {0x0, 0x0}, {0x0, 0x0}, {0xc0003e2440, 0x36}, 0x1, {0x0, ...}})
github.com/evanw/esbuild/cmd/esbuild/service.go:969 +0x785
github.com/evanw/esbuild/pkg/api.(*pluginImpl).onResolve.func1({{0xc0004369e0, 0xe}, {0xc0003e2440, 0x36}, {0x0, 0x0}, {{0x0, 0x0}, {0x0, 0x0}, ...}, ...})
github.com/evanw/esbuild/pkg/api/api_impl.go:1920 +0x215
github.com/evanw/esbuild/internal/bundler.RunOnResolvePlugins({_, _, _}, _, {0xc00047e1c0, 0xc00047c498, 0xc00047c4b0, 0xc0004173e0, 0x5, 0xc00012e7b0}, ...)
github.com/evanw/esbuild/internal/bundler/bundler.go:828 +0x8d5
github.com/evanw/esbuild/internal/bundler.(*scanner).addEntryPoints.func1(0x3, {{0xc0004369e0, 0xe}, {0x0, 0x0}, 0x0})
github.com/evanw/esbuild/internal/bundler/bundler.go:1650 +0x205
created by github.com/evanw/esbuild/internal/bundler.(*scanner).addEntryPoints
github.com/evanw/esbuild/internal/bundler/bundler.go:1643 +0xc3a
goroutine 68 [chan receive]:
main.(*serviceType).sendRequest(0xc000099ef0, {0x150edc0, 0xc00026b890})
github.com/evanw/esbuild/cmd/esbuild/service.go:192 +0xfa
main.(*serviceType).convertPlugins.func2.3({{0xc0004369f0, 0xd}, {0x0, 0x0}, {0x0, 0x0}, {0xc0003e2440, 0x36}, 0x1, {0x0, ...}})
github.com/evanw/esbuild/cmd/esbuild/service.go:969 +0x785
github.com/evanw/esbuild/pkg/api.(*pluginImpl).onResolve.func1({{0xc0004369f0, 0xd}, {0xc0003e2440, 0x36}, {0x0, 0x0}, {{0x0, 0x0}, {0x0, 0x0}, ...}, ...})
github.com/evanw/esbuild/pkg/api/api_impl.go:1920 +0x215
github.com/evanw/esbuild/internal/bundler.RunOnResolvePlugins({_, _, _}, _, {0xc00047e1c0, 0xc00047c498, 0xc00047c4b0, 0xc0004173e0, 0x5, 0xc00012e7b0}, ...)
github.com/evanw/esbuild/internal/bundler/bundler.go:828 +0x8d5
github.com/evanw/esbuild/internal/bundler.(*scanner).addEntryPoints.func1(0x4, {{0xc0004369f0, 0xd}, {0x0, 0x0}, 0x0})
github.com/evanw/esbuild/internal/bundler/bundler.go:1650 +0x205
created by github.com/evanw/esbuild/internal/bundler.(*scanner).addEntryPoints
github.com/evanw/esbuild/internal/bundler/bundler.go:1643 +0xc3a
goroutine 69 [chan receive]:
main.(*serviceType).sendRequest(0xc000099ef0, {0x150edc0, 0xc00026b8c0})
github.com/evanw/esbuild/cmd/esbuild/service.go:192 +0xfa
main.(*serviceType).convertPlugins.func2.3({{0xc000436a00, 0xc}, {0x0, 0x0}, {0x0, 0x0}, {0xc0003e2440, 0x36}, 0x1, {0x0, ...}})
github.com/evanw/esbuild/cmd/esbuild/service.go:969 +0x785
github.com/evanw/esbuild/pkg/api.(*pluginImpl).onResolve.func1({{0xc000436a00, 0xc}, {0xc0003e2440, 0x36}, {0x0, 0x0}, {{0x0, 0x0}, {0x0, 0x0}, ...}, ...})
github.com/evanw/esbuild/pkg/api/api_impl.go:1920 +0x215
github.com/evanw/esbuild/internal/bundler.RunOnResolvePlugins({_, _, _}, _, {0xc00047e1c0, 0xc00047c498, 0xc00047c4b0, 0xc0004173e0, 0x5, 0xc00012e7b0}, ...)
github.com/evanw/esbuild/internal/bundler/bundler.go:828 +0x8d5
github.com/evanw/esbuild/internal/bundler.(*scanner).addEntryPoints.func1(0x5, {{0xc000436a00, 0xc}, {0x0, 0x0}, 0x0})
github.com/evanw/esbuild/internal/bundler/bundler.go:1650 +0x205
created by github.com/evanw/esbuild/internal/bundler.(*scanner).addEntryPoints
github.com/evanw/esbuild/internal/bundler/bundler.go:1643 +0xc3a
goroutine 70 [chan receive]:
main.(*serviceType).sendRequest(0xc000099ef0, {0x150edc0, 0xc00026b7a0})
github.com/evanw/esbuild/cmd/esbuild/service.go:192 +0xfa
main.(*serviceType).convertPlugins.func2.3({{0xc0004369ba, 0x6}, {0x0, 0x0}, {0x0, 0x0}, {0xc0003e2440, 0x36}, 0x1, {0x0, ...}})
github.com/evanw/esbuild/cmd/esbuild/service.go:969 +0x785
github.com/evanw/esbuild/pkg/api.(*pluginImpl).onResolve.func1({{0xc0004369ba, 0x6}, {0xc0003e2440, 0x36}, {0x0, 0x0}, {{0x0, 0x0}, {0x0, 0x0}, ...}, ...})
github.com/evanw/esbuild/pkg/api/api_impl.go:1920 +0x215
github.com/evanw/esbuild/internal/bundler.RunOnResolvePlugins({_, _, _}, _, {0xc00047e1c0, 0xc00047c498, 0xc00047c4b0, 0xc0004173e0, 0x5, 0xc00012e7b0}, ...)
github.com/evanw/esbuild/internal/bundler/bundler.go:828 +0x8d5
github.com/evanw/esbuild/internal/bundler.(*scanner).addEntryPoints.func1(0x6, {{0xc0004369ba, 0x6}, {0x0, 0x0}, 0x0})
github.com/evanw/esbuild/internal/bundler/bundler.go:1650 +0x205
created by github.com/evanw/esbuild/internal/bundler.(*scanner).addEntryPoints
github.com/evanw/esbuild/internal/bundler/bundler.go:1643 +0xc3a
Toggle to view system info
System:
OS: macOS 13.4.1
CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
Memory: 1.18 GB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.14.0 - ~/.nvm/versions/node/v18.14.0/bin/node
npm: 9.3.1 - ~/.nvm/versions/node/v18.14.0/bin/npm
Browsers:
Chrome: 118.0.5993.117
Firefox: 100.0
Safari: 16.5.1
npmPackages:
@sveltejs/adapter-static: 2.0.3 => 2.0.3
@sveltejs/kit: 1.27.1 => 1.27.1
@sveltejs/package: 2.2.2 => 2.2.2
@sveltejs/vite-plugin-svelte: 2.4.2 => 2.4.6
@vitest/coverage-v8: 0.34.6 => 0.34.6
svelte: 4.2.2 => 4.2.2
vite: 4.5.0 => 4.5.0
vitest: 0.34.6 => 0.34.6
Note: The workaround mentioned by @peterpeterparker does indeed fix it.
If I specifically install @sveltejs/[email protected] the issue is resolved.
Edit: The latest version of Svelte Kit has this dependency:
...but for some reason npm just didn't want to update @sveltejs/vite-plugin-svelte past v2.4.2 if I installed an updated version of kit. Deleting my package-lock fixed this. Urgh.