-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Running on root directory "Failed to resolve entry for package" #6859
Comments
I've tested in a container running
Then on a browser: |
[vite] Internal server error: Failed to resolve entry for package... Workaround; Entry point differs from {
"main": "[your_entry_point]"
} |
I encounter this issue with vite 2.9+ and it wasn't the case before. Defining an entry point in the “main” field of But since I'm already defining my two entry points in |
Same. Started facing this after 2.9. I was able to reproduce it here - https://stackblitz.com/edit/github-12zodn?file=src%2Fentry-server.js&terminal=dev For me, It seems to be happening when I use |
@saurabhdaware My issue was indeed caused by You probably don't have the exact same problem but you can log |
I think #7869 will resolve this right @poyoho? (Ref: #6859 (comment)) I am guessing the issue is happening because |
Yeah I think my issue is a bit different. Due to #7913 my code is rendering a non-existent src in |
hello, is same with #7913 ? |
after this PR, inline style will keep. and add a request for hmr. I test it in vite playground, it seem to work well. could you like to test in your case? |
It is a bit different. The issue I mentioned in comment here #6859 (comment) seems to be because of the inlined CSS change however the cause for the original issue might be different. But I don't think it will resolve this issue since it seems to be created before 2.9 release. The reason for original issue is probably different.
Yup I'll check this |
Just checked locally for my use-case. Your PR did fix the #7913 but it did not fix this issue for me. This might be something different. |
I noted. Is may all request process into |
I don't konw . Is same problem cause of this ? |
If I create a package at root directory , and package directory name is "foo“ , then vite devsever response vite_url:3000/foo , will throw this error. |
https://stackblitz.com/edit/github-12zodn-j9tw2b?file=server.js I test it, it maybe is not the vite bug? |
We fixed the issue using the workaround provided by #6859 (comment). Adding |
oh sorry, I think it same with vitejs/vite-plugin-vue#25 ? |
Not sure if I understood the 7220 but it seems a bit different to me. For me this is happening when I pass I added some logs in this - https://stackblitz.com/edit/github-12zodn-joz2gx?file=server.js&terminal=dev You can see that it is failing on transformIndexHtml 🤔 |
Hello @poyoho Nice to meet you. Now I am having this issue:
When I pnpm i, then it shows the above issue. |
@chris-sab do you create the project start with root dir |
I get a different, but possibly related bug when I try to build with Vite (first time user). The difference is that Vite is failing to link a dependency of one of my dependencies. I'm using Vite 3.0.9 on MacOS. [commonjs] Failed to resolve entry for package "@opentelemetry/otlp-exporter-base". The package may have incorrect main/module/exports specified in its package.json.
file: /Users/kris/WebstormProjects/polywrap/demos/hello-world/app/solidjs/node_modules/@polywrap/core-js/build/uri-resolution/resolvers/index.js
error during build:
Error: Failed to resolve entry for package "@opentelemetry/otlp-exporter-base". The package may have incorrect main/module/exports specified in its package.json.
at packageEntryFailure (file:///Users/kris/WebstormProjects/polywrap/demos/hello-world/app/solidjs/node_modules/vite/dist/node/chunks/dep-0fc8e132.js:34705:11)
at resolvePackageEntry (file:///Users/kris/WebstormProjects/polywrap/demos/hello-world/app/solidjs/node_modules/vite/dist/node/chunks/dep-0fc8e132.js:34702:5)
at tryNodeResolve (file:///Users/kris/WebstormProjects/polywrap/demos/hello-world/app/solidjs/node_modules/vite/dist/node/chunks/dep-0fc8e132.js:34452:20)
at Object.resolveId (file:///Users/kris/WebstormProjects/polywrap/demos/hello-world/app/solidjs/node_modules/vite/dist/node/chunks/dep-0fc8e132.js:34254:28)
at file:///Users/kris/WebstormProjects/polywrap/demos/hello-world/app/solidjs/node_modules/rollup/dist/es/shared/rollup.js:22695:37
error Command failed with exit code 1. |
@krisbitney did you end up figuring this out? |
Still having same issue !!! |
Same issue for me as well node: 18.12.1
|
I have also noticed that if vite can't find the lib in question it reports using this error. Instead of saying it's missing it says something else which is confusing. I have solved this by adding the package to the lib that was missing. |
I had the same error as you and the reason was in |
I started having this issue when one of my dependencies switched from using the The only solution I have found is to declare an alias for this dependency pointing to its entry point in the // simplified for brevity
export default defineConfig({
resolve: {
alias: {
'leaflet.gridlayer.googlemutant': './node_modules/leaflet.gridlayer.googlemutant/dist/Leaflet.GoogleMutant.js'
}
}
}) I hope this gets fixed soon. |
I've the same issue, I cloned https://github.com/vitejs/vite-plugin-vue and tried the /playground/ssr-vue example, after installing with pnpm and npm run dev
Node.js v19.7.0 |
This is replicable using React with React Router too. For anyone else with the same problem, as the above says just set your
|
I had the same error, deleting node_modules and running |
Just encountered something that may be very much related to this in SvelteKit (Although it also happens when using vite directly) It doesn't matter which directory it is, could be totally unrelated to the directory vite was started in. This probably shouldn't happen. |
have you resolved this? i had the same issue with |
Hey, I've had this issue with This is also cause by the way imports works in typescript, and more precisely import of types. Theses three following imports tell typescript to do different things, and only the last one is the good one in our case: // try to import the symbol MenuItem of the package, fails here because there is no code
import { MenuItem } from 'primevue/menuitem';
// translated to the following javascript
import { MenuItem } from 'primevue/menuitem';
// does not try to import the MenuItem symbol, but still try to import the package, in case the package does some side effects
// and so fails, because there is still no code
import { type MenuItem } from 'primevue/menuitem';
// translated to the following javascript
import {} from 'primevue/menuitem';
// does not try to import the MenuItem symbol nor the package
import { type MenuItem } from 'primevue/menuitem';
// translated to no javascript at all, the whole import is eluded, and vite is happy I had the error personally because we used the typescript-eslint rule consistent-type-imports with the fix style as |
Describe the bug
When running on Linux, in the root directory, if you try to access vite_url:3000/path-of-working-dir, you will get the following error:
Steps to reproduce:
cd /
npm create vite@latest my-vue-app -- --template vue
cd my-vue-app
npm run dev
http://192.168.64.13:3000/my-vue-app
If
my-vue-app
is on any other folder other than/
(root directory) this error doesn't happen.This is running on a Ubuntu VM inside my M1 Pro Macbook.
Reproduction
Reproduction steps above
System Info
Used Package Manager
npm
Logs
The text was updated successfully, but these errors were encountered: