vueuse / vue-demi

🎩 Creates Universal Library for Vue 2 & 3
MIT License
3.01k stars 158 forks source link

The requested module 'vue-demi' does not provide an export named 'hasInjectionContext' #230

Closed ncnt257 closed 1 year ago

ncnt257 commented 1 year ago

I'm using Nuxt 3.1.1 with vueuse/nuxt 9.13.0 (NodeJS 16.3.0). I just reinstalled the packages yesterday and meet this error.

The requested module 'vue-demi' does not provide an export named 'hasInjectionContext'

at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21) at async ModuleJob.run (node:internal/modules/esm/module_job:181:5) at async Promise.all (index 0) at async ESMLoader.import (node:internal/modules/esm/loader:281:24)

kumv-net commented 1 year ago

pinia same error,need fix as soon as possible

kumv-net commented 1 year ago

caught SyntaxError: The requested module '/@fs/E:/xxx/node_modules/.pnpm/vue-demi@0.14.5_vue@3.3.4/node_modules/vue-demi/lib/index.mjs?v=5975676c' does not provide an export named 'hasInjectionContext' (at pinia.mjs:6:10)

http://localhost:5173/@fs/E:/xxx/node_modules/.pnpm/pinia@2.1.3_typescript@5.0.4_vue@3.3.4/node_modules/pinia/dist/pinia.mjs

import { hasInjectionContext, inject, toRaw, watch, unref, markRaw, effectScope , ref, isVue2, isRef, isReactive, set, getCurrentScope, onScopeDispose, getCurrentInstance , reactive, toRef, del, nextTick, computed, toRefs } from "/@fs/E:/xxx/node_modules/.pnpm/vue-demi@0.14.5_vue@3.3.4/node_modules/vue-demi/lib/index.mjs?v=5975676c";

Teaghy commented 1 year ago

捕获语法错误:请求的模块'/@fs/E:/xxx/node_modules/.pnpm/vue-demi@0.14.5_vue@3.3.4/node_modules/vue-demi/lib/index.mjs?v=5975676c'确实不提供名为“hasInjectionContext”的导出(在 pinia.mjs:6:10)

http://localhost:5173/@fs/E:/xxx/node_modules/.pnpm/pinia@2.1.3_typescript@5.0.4_vue@3.3.4/node_modules/pinia/dist/pinia.mjs

import { hasInjectionContext, inject, toRaw, watch, unref, markRaw, effectScope , ref, isVue2, isRef, isReactive, set, getCurrentScope, onScopeDispose, getCurrentInstance, reactive, toRef, del, nextTick, computed, toRefs } from "/@fs/ E:/xxx/node_modules/.pnpm/vue-demi@0.14.5_vue@3.3.4/node_modules/vue-demi/lib/index.mjs?v=5975676c";

In vue-demi, 'hasInjectionContext' is provided by Vue in version 3. Please check if your Vue version is up-to-date and provides this method. I'm using the latest version of Vue and Pinia, and I haven't encountered the issue you mentioned. You can try it out.

esorribas commented 1 year ago
  1. Drop "overrides>vue" directive on package.json
  2. npm uninstall pinia
  3. npm install --legacy-peer-deps pinia
McLamy commented 1 year ago

@esorribas After your comment I was able to get "NITRO_PRESET=firebase yarn build" up and running 👍

marcodarko commented 7 months ago

Any luck with this? I've tried all the things online and absolutely no luck.