求解
根据官网提示使用npx degit dcloudio/uni-preset-vue#vite-ts my-vue3-project 创建项目
使用pnpm安装依赖,然后运行pnpm dev:mp-weixin 就报错了
node版本 16.14.2、16.18.0、19.0.0切换试过
pnpm版本 7.33.6、8.3.1也都切换试过,依然是这样
中间也试过npx @dcloudio/uvm 更新,依旧没辙
报错内容是:
"looseToNumber" is not exported by "../../node_modules/@vue/shared/dist/shared.esm-bundler.js", imported by "node_modules/.pnpm/registry.npmmirror.com+@dcloudio+uni-mp-vue@3.0.0-3080720230703001/node_modules/@dcloudio/uni-mp-vue/dist/vue.runtime.esm.js".
at ../node_modules/.pnpm/registry.npmmirror.com+@dcloudio+uni-mp-vue@3.0.0-3080720230703001/node_modules/@dcloudio/uni-mp-vue/dist/vue.runtime.esm.js:2:327
1: import { isRootHook, getValueByDataPath, isUniLifecycleHook, ON_ERROR, UniLifecycleHooks, invokeCreateErrorHandler, dynamicSlotName } from '@dcloudio/uni-shared';
2: import { extend, isObject, def, hasChanged, isArray, isString, isFunction, isPromise, EMPTY_OBJ, remove, toHandlerKey, camelize, capitalize, hasOwn, hyphenate, isReservedProp, toRawType, normalizeClass, normalizeStyle, isOn, toTypeString, NOOP, isMap, isIntegerKey, isSet, isPlainObject, makeMap, invokeArrayFns, NO, isSymbol, looseToNum...
^
3: export { EMPTY_OBJ, camelize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared';
7***@qq.com (作者)
噢噢 可以的 https://uniapp.dcloud.net.cn/quickstart-cli.html#cliversion 其实用npm安装依赖是可以的 但是用pnpm不行就不知道为啥了。
2023-08-14 21:07
昭昭L
回复 7***@qq.com: npm可以吗?跑成功了我就不看了,pnpm虽然比npm速度快,但兼容性没有pnpm好确实可能会有意想不到的问题
2023-08-14 21:19