bug: "ionic serve" fails to detect vite in npm workspaces
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 45/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- node.js, typescript, vite
- Área
- cli
Línea de trabajo
Comienza por la ruta de detección de Vite del comando ionic serve y reproduce el fallo desde packages/test en un proyecto npm-workspaces. Rastrea cómo la CLI resuelve Vite desde el subdirectorio y, después, verifica que el comando reconoce la instalación hoisted y sigue funcionando para un proyecto normal.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Prerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already report this problem, without success.
Ionic Framework Version
v7.x
Current Behavior
In my ionic/react project, when I run "ionic serve" it gives the following error:
[INFO] Looks like vite isn't installed in this project.
This package is required for this command to work properly. The package provides a CLI utility, but the vite
binary was not found in your PATH.
The problem is that vite is installed, but ionic is unable to detect it. This happens because my project is a monorepo using npm workspaces - one of the packages (packages/ui-ionic) is my Ionic-basd application, generated from the template, while other subpackages represent libraries. Note that in every other way the project works, I'm able to run unit tests, and vite dev does what you would expect.
The vite can be found at <project_root>/node_modules, however because my ionic app is in a subdirectory, I have to cd to that subdirectory to order to run the frontend. When I do this, ionic serve fails with the error message. I'm guessing that the ionic command is checking only the node_modules in the current directory, instead of searching upwards in the file hierarchy as per the standard node resolution algorithm.
Also note that installing vite explicitly as a dependency of the subpackage doesn't help, because npm still hoists it to the root level.
Expected Behavior
The ionic command should check for the existence of vite using the standard node module resolution algorithm instead of assuming that it's in the node_modules in the current directory.
Steps to Reproduce
- Create a blank Ionic project using the wizard.
- Move the src, public, index.html and vite.config.ts into a subdirectory named packages/test. Create a minimal package.json and tsconfig.json and place it in the same directory.
- Add "workspaces": [ "./packages/*" ] to the top-level package.json.
- Copy the "scripts" commands from the top-level package into the subpackage (you only need the ones that invoke Vite).
Now cd to packages/test and try to run the app. You should see the error message about Vite not being installed.
Code Reproduction URL
No response
Ionic Info
Ionic:
Ionic CLI : 7.1.1
Utility:
cordova-res : not installed globally
native-run : not installed globally
System:
NodeJS : v18.10.0
npm : 8.19.2
OS : macOS Monterey
Additional Information
No response
- Lenguaje dominante
- TypeScript
- Estrellas
- 2k
- Forks
- 681
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de ionic-team/ionic-cli
-
triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 65/100
ionic-team/ionic-cli#5016 ·
-
ionic-cli development status Abiertotriage
Dificultad 5/5 Más de una semana Aptitud para principiantes 15/100
ionic-team/ionic-cli#5131 ·
-
triage
Dificultad 3/5 1-2 días Aptitud para principiantes 56/100
ionic-team/ionic-cli#5130 ·
-
triage
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
ionic-team/ionic-cli#5129 ·
-
triage
Dificultad 3/5 1-2 días Aptitud para principiantes 42/100
ionic-team/ionic-cli#5127 · 2 comentarios ·
Todos los issues de ionic-team/ionic-cli
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
copse-dev/agent-pane#2953 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
[Bug]: Matrix progress drafts fail with "Matrix runtime not initialized" during tool activity Abiertobug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Client support matrix inclusion Abiertoenhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
calcite-components needs triage refactor
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Esri/calcite-design-system#15203 ·