开发环境:mac系统,node版本: 16.15.0
版本兼容问题
javascript
vite v3.2.4 building for development...
'hasInjectionContext' is not exported by node_modules/pinia/node_modules/vue-demi/lib/index.mjs, imported by node_modules/pinia/dist/pinia.mjs
at ../node_modules/pinia/dist/pinia.mjs:6:9
4: * @license MIT
5: */
6: import { hasInjectionContext, inject, toRaw, watch, unref, markRaw, effectScope, ref, isVue2, isRef, isReactive, set, getCurrentScope, onScopeDispose, getCurrentInstance, reactive, toRef, del, nextTick, computed, toRefs } from 'vue-demi';
^
7: import { setupDevtoolsPlugin } from '@vue/devtools-api';
解决方案1
升级或降级(版本)
思路
Vue和pinia 版本不兼容;Vue 的版本为 "vue": "^3.2.47", pinia的版本为 "pinia": "^2.0.36"
解决过程
升高pinia的版本 "pinia": "^2.0.36", ==》 "pinia": "^2.0.36",
先删除pinia
npm uni pinia
再重新安装
yarn add pinia@2.0.36
修改后如下图: