3***@qq.com
3***@qq.com
  • 发布:2023-09-27 18:37
  • 更新:2024-10-21 17:58
  • 阅读:292

【报Bug】CLI Vite ts 版本无法安装pinia永久存储插件?

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Mac

PC开发环境操作系统版本号: 12.5

手机系统: iOS

手机系统版本号: iOS 16

手机厂商: 模拟器

手机机型: 14 max pro

页面类型: vue

vue版本: vue3

打包方式: 离线

项目创建方式: CLI

CLI版本号: 5.08

示例代码:
{  
  "name": "uni-preset-vue",  
  "version": "0.0.0",  
  "scripts": {  
    "dev:app": "uni -p app",  
    "dev:app-android": "uni -p app-android",  
    "dev:app-ios": "uni -p app-ios",  
    "dev:custom": "uni -p",  
    "dev:h5": "uni",  
    "dev:h5:ssr": "uni --ssr",  
    "dev:mp-alipay": "uni -p mp-alipay",  
    "dev:mp-baidu": "uni -p mp-baidu",  
    "dev:mp-jd": "uni -p mp-jd",  
    "dev:mp-kuaishou": "uni -p mp-kuaishou",  
    "dev:mp-lark": "uni -p mp-lark",  
    "dev:mp-qq": "uni -p mp-qq",  
    "dev:mp-toutiao": "uni -p mp-toutiao",  
    "dev:wx": "uni -p mp-weixin",  
    "dev:quickapp-webview": "uni -p quickapp-webview",  
    "dev:quickapp-webview-huawei": "uni -p quickapp-webview-huawei",  
    "dev:quickapp-webview-union": "uni -p quickapp-webview-union",  
    "build:app": "uni build -p app",  
    "build:app-android": "uni build -p app-android",  
    "build:app-ios": "uni build -p app-ios",  
    "build:custom": "uni build -p",  
    "build:h5": "uni build",  
    "build:h5:ssr": "uni build --ssr",  
    "build:mp-alipay": "uni build -p mp-alipay",  
    "build:mp-baidu": "uni build -p mp-baidu",  
    "build:mp-jd": "uni build -p mp-jd",  
    "build:mp-kuaishou": "uni build -p mp-kuaishou",  
    "build:mp-lark": "uni build -p mp-lark",  
    "build:mp-qq": "uni build -p mp-qq",  
    "build:mp-toutiao": "uni build -p mp-toutiao",  
    "build:mp-weixin": "uni build -p mp-weixin",  
    "build:quickapp-webview": "uni build -p quickapp-webview",  
    "build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei",  
    "build:quickapp-webview-union": "uni build -p quickapp-webview-union",  
    "type-check": "vue-tsc --noEmit"  
  },  
  "dependencies": {  
    "@dcloudio/uni-app": "3.0.0-3081220230817001",  
    "@dcloudio/uni-app-plus": "3.0.0-3081220230817001",  
    "@dcloudio/uni-components": "3.0.0-3081220230817001",  
    "@dcloudio/uni-h5": "3.0.0-3081220230817001",  
    "@dcloudio/uni-mp-alipay": "3.0.0-3081220230817001",  
    "@dcloudio/uni-mp-baidu": "3.0.0-3081220230817001",  
    "@dcloudio/uni-mp-jd": "3.0.0-3081220230817001",  
    "@dcloudio/uni-mp-kuaishou": "3.0.0-3081220230817001",  
    "@dcloudio/uni-mp-lark": "3.0.0-3081220230817001",  
    "@dcloudio/uni-mp-qq": "3.0.0-3081220230817001",  
    "@dcloudio/uni-mp-toutiao": "3.0.0-3081220230817001",  
    "@dcloudio/uni-mp-weixin": "3.0.0-3081220230817001",  
    "@dcloudio/uni-quickapp-webview": "3.0.0-3081220230817001",  
    "pinia": "2.0.33",  
    "vue": "^3.2.45",  
    "vue-i18n": "^9.1.9"  
  },  
  "devDependencies": {  
    "@dcloudio/types": "^3.3.2",  
    "@dcloudio/uni-automator": "3.0.0-3081220230817001",  
    "@dcloudio/uni-cli-shared": "3.0.0-3081220230817001",  
    "@dcloudio/uni-stacktracey": "3.0.0-3081220230817001",  
    "@dcloudio/vite-plugin-uni": "3.0.0-3081220230817001",  
    "@types/wechat-miniprogram": "^3.4.3",  
    "@uni-helper/uni-app-types": "^0.5.11",  
    "@uni-helper/uni-ui-types": "^0.5.11",  
    "@vue/runtime-core": "^3.2.45",  
    "@vue/tsconfig": "^0.1.3",  
    "typescript": "^4.9.4",  
    "vite": "4.1.4",  
    "vue-tsc": "^1.0.24"  
  }  
}  

操作步骤:
npm install pinia@2.0.33  

npm i -D pinia-plugin-persistedstate

预期结果:

null

实际结果:

报错。

bug描述:

通过 CLI 安装 vite-ts 版本
成功安装了 pinia 之后在安装永久存储插件npm i -D pinia-plugin-persistedstate报错:

npm ERR! code ERESOLVE  
npm ERR! ERESOLVE could not resolve  
npm ERR!   
npm ERR! While resolving: uni-preset-vue@0.0.0  
npm ERR! Found: vue@3.2.47  
npm ERR! node_modules/vue  
npm ERR!   peer vue@"^3.2.25" from @vitejs/plugin-vue@4.3.4  
npm ERR!   node_modules/@vitejs/plugin-vue  
npm ERR!     @vitejs/plugin-vue@"^4.2.1" from @dcloudio/uni-app-vite@3.0.0-3081220230817001  
npm ERR!     node_modules/@dcloudio/uni-app-vite  
npm ERR!       @dcloudio/uni-app-vite@"3.0.0-3081220230817001" from @dcloudio/uni-app-plus@3.0.0-3081220230817001  
npm ERR!       node_modules/@dcloudio/uni-app-plus  
npm ERR!         @dcloudio/uni-app-plus@"3.0.0-3081220230817001" from the root project  
npm ERR!     @vitejs/plugin-vue@"^4.2.1" from @dcloudio/vite-plugin-uni@3.0.0-3081220230817001  
npm ERR!     node_modules/@dcloudio/vite-plugin-uni  
npm ERR!       dev @dcloudio/vite-plugin-uni@"3.0.0-3081220230817001" from the root project  
npm ERR!   peer vue@"^3.0.0" from @vitejs/plugin-vue-jsx@3.0.2  
npm ERR!   node_modules/@vitejs/plugin-vue-jsx  
npm ERR!     @vitejs/plugin-vue-jsx@"^3.0.1" from @dcloudio/vite-plugin-uni@3.0.0-3081220230817001  
npm ERR!     node_modules/@dcloudio/vite-plugin-uni  
npm ERR!       dev @dcloudio/vite-plugin-uni@"3.0.0-3081220230817001" from the root project  
npm ERR!   4 more (@vue/server-renderer, vue-i18n, vue-router, the root project)  
npm ERR!   
npm ERR! Could not resolve dependency:  
npm ERR! pinia@"2.0.33" from the root project  
npm ERR!   
npm ERR! Conflicting peer dependency: vue@3.3.4  
npm ERR! node_modules/vue  
npm ERR!   peer vue@">= 2.5 < 2.7" from @vue/composition-api@1.7.2  
npm ERR!   node_modules/@vue/composition-api  
npm ERR!     peerOptional @vue/composition-api@"^1.4.0" from pinia@2.0.33  
npm ERR!     node_modules/pinia  
npm ERR!       pinia@"2.0.33" from the root project  
npm ERR!   
npm ERR! Fix the upstream dependency conflict, or retry  
npm ERR! this command with --force or --legacy-peer-deps  
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
2023-09-27 18:37 负责人:无 分享
已邀请:
retrocode

retrocode - 现已加入旺旺大礼包全家桶

我遇到了相同问题, 请问下找到解决方法了吗

要回复问题请先登录注册