English 中文(简体)
错误: 导入了下列依赖关系但无法解决 。 无法使用我们用 vue 和 vite 创建的自定义库
原标题:Error: The following dependencies are imported but could not be resolved. Unable to use custom library we created using vue and vite
Have created library that contain component, enums and interfaces using vite and vue. Have installed the library using npm install file:./dist/ Library appeared in nodemodule folder. After importing specific component it throw below exception Error: The following dependencies are imported but could not be resolved: test-component (imported by D:/Workspace/SulekhaAppFrameWork/Sul_App_Base_V1/ViteCustomLibary/src/App.vue?id=0) Are they installed? at file:../node_modules/vite/dist/node/chunks/dep-df561101.js:45705:23 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async file:///.../node_modules/vite/dist/node/chunks/dep-df561101.js:45114:38 Have created common library using vue and vite. npm run build will create the library in dist folder Have mention that dist folder in package.json ("privatelibrary":file/../dist) to install the custom library. After executing npm install Able to find the folder in the name of privatelibrary. imported component from privatelibrary Getting below error when we run the application using npm run dev Error: The following dependencies are imported but could not be resolved: test-component (imported by D:/Workspace/SulekhaAppFrameWork/Sul_App_Base_V1/ViteCustomLibary/src/App.vue?id=0) Are they installed? at file:../node_modules/vite/dist/node/chunks/dep-df561101.js:45705:23 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async file:///.../node_modules/vite/dist/node/chunks/dep-df561101.js:45114:38
问题回答
I had a similar issue: $ npm run dev > dev > vite Port 5173 is in use, trying another one... VITE v5.3.1 ready in 593 ms ➜ Local: http://localhost:5174/ ➜ Network: use --host to expose ➜ press h + enter to show help LARAVEL v11.12.0 plugin v1.0.4 ➜ APP_URL: http://localhost Error: The following dependencies are imported but could not be resolved: vue-router (imported by /home/mirad/Documents/Perso/Projects/email-sender/resources/js/app.js) Are they installed? at file:///home/mirad/Documents/Perso/Projects/email-sender/node_modules/vite/dist/node/chunks/dep-BcXSligG.js:51104:15 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async file:///home/mirad/Documents/Perso/Projects/email-sender/node_modules/vite/dist/node/chunks/dep-BcXSligG.js:50609:26 The issue was fixed by simply adding a / to the vue-router when imported: Before import VueRouter from "vue-router"; After import VueRouter from "/vue-router";
You should use the following as a workaround: import type { types } from xxx




相关问题
How to combine shared libraries?

I ve got some .so libraries that I d like to combine into one shared library so that it doesn t depend on the original .so files anymore. The .so files have dependencies to each other. How can I do ...

Shared library in Go?

Is it possible to create a Shared Library (.so) using Go? UPDATED: created an "issue" for it.

Create a shared lib using another shared lib

I have a shared library "libwiston.so". I am using this to create another shared library called "libAnimation.so", which will be used by another project. Now, the second library "libAnimation.so" can ...

Load multiple copies of a shared library

I am running Linux, and I would like to be able to make parallel function calls into a shared library (.so) which is unfortunately not threadsafe (I am guessing it has global datastructures). For ...

热门标签