将3.6.2升级到4.0之后,发现新版本报错用不了,然后回退到3.6.2,旧项目启动不了,全局taro -v 显示3.6.2

kx7yvsdv  于 3个月前  发布在  其他
关注(0)|答案(2)|浏览(46)

相关平台

微信小程序

复现仓库

https://github.com/Aliujiayu/taro4.git ### 这个基本可以忽略,是老项目,没法出demo,这个地址是升级后4.0版本的demo,就升级这个导致旧项目报错
小程序基础库: 3.5.4
使用框架: React

复现步骤

将3.6.2升级到4.0之后,发现新版本报错用不了,然后回退到3.6.2,结果旧项目启动不了,全局taro -v 显示3.6.2
能使用的手段都用了,依然报错,没升级之前是好的

期望结果

希望能尽快解决,让老项目正常运行,已经拖了很久很久了

实际结果

终端报错

⚠️ Warnings: 

    at HarmonyImportSpecifierDependency.getLinkingErrors (/Users/liujiayu/Desktop/mianshiyanshi/xtNew/hp-teacher3/node_modules/.pnpm/webpack@5.69.0_@swc+core@1.3.42/node_modules/webpack/lib/dependencies/HarmonyImportDependency.js:160:8)
ModuleDependencyWarning: export 'isHasExtractProp' (imported as 'isHasExtractProp') was not found in '@tarojs/runtime' (possible exports: Current, Events, FormElement, History, Location, MutationObserver, SVGElement, Style, TaroElement, TaroEvent, TaroNode, TaroRootElement, TaroText, URL, URLSearchParams, addLeadingSlash, cancelAnimationFrame, createComponentConfig, createEvent, createPageConfig, createRecursiveComponentConfig, document, eventCenter, eventHandler, eventSource, getComputedStyle, getCurrentInstance, getPageInstance, history, hooks, hydrate, incrementId, injectPageInstance, location, navigator, nextTick, now, options, parseUrl, removePageInstance, requestAnimationFrame, safeExecute, stringify, window)

    at HarmonyImportSpecifierDependency.getLinkingErrors (/Users/liujiayu/Desktop/mianshiyanshi/xtNew/hp-teacher3/node_modules/.pnpm/webpack@5.69.0_@swc+core@1.3.42/node_modules/webpack/lib/dependencies/HarmonyImportDependency.js:160:8)
ModuleDependencyWarning: export 'isHasExtractProp' (imported as 'isHasExtractProp') was not found in '@tarojs/runtime' (possible exports: Current, Events, FormElement, History, Location, MutationObserver, SVGElement, Style, TaroElement, TaroEvent, TaroNode, TaroRootElement, TaroText, URL, URLSearchParams, addLeadingSlash, cancelAnimationFrame, createComponentConfig, createEvent, createPageConfig, createRecursiveComponentConfig, document, eventCenter, eventHandler, eventSource, getComputedStyle, getCurrentInstance, getPageInstance, history, hooks, hydrate, incrementId, injectPageInstance, location, navigator, nextTick, now, options, parseUrl, removePageInstance, requestAnimationFrame, safeExecute, stringify, window)

    at HarmonyImportSpecifierDependency.getLinkingErrors (/Users/liujiayu/Desktop/mianshiyanshi/xtNew/hp-teacher3/node_modules/.pnpm/webpack@5.69.0_@swc+core@1.3.42/node_modules/webpack/lib/dependencies/HarmonyImportDependency.js:160:8)
ModuleDependencyWarning: export 'isHasExtractProp' (imported as 'isHasExtractProp') was not found in '@tarojs/runtime' (possible exports: Current, Events, FormElement, History, Location, MutationObserver, SVGElement, Style, TaroElement, TaroEvent, TaroNode, TaroRootElement, TaroText, URL, URLSearchParams, addLeadingSlash, cancelAnimationFrame, createComponentConfig, createEvent, createPageConfig, createRecursiveComponentConfig, document, eventCenter, eventHandler, eventSource, getComputedStyle, getCurrentInstance, getPageInstance, history, hooks, hydrate, incrementId, injectPageInstance, location, navigator, nextTick, now, options, parseUrl, removePageInstance, requestAnimationFrame, safeExecute, stringify, window)

    at HarmonyImportSpecifierDependency.getLinkingErrors (/Users/liujiayu/Desktop/mianshiyanshi/xtNew/hp-teacher3/node_modules/.pnpm/webpack@5.69.0_@swc+core@1.3.42/node_modules/webpack/lib/dependencies/HarmonyImportDependency.js:160:8)
ModuleDependencyWarning: export 'isHasExtractProp' (imported as 'isHasExtractProp') was not found in '@tarojs/runtime' (possible exports: Current, Events, FormElement, History, Location, MutationObserver, SVGElement, Style, TaroElement, TaroEvent, TaroNode, TaroRootElement, TaroText, URL, URLSearchParams, addLeadingSlash, cancelAnimationFrame, createComponentConfig, createEvent, createPageConfig, createRecursiveComponentConfig, document, eventCenter, eventHandler, eventSource, getComputedStyle, getCurrentInstance, getPageInstance, history, hooks, hydrate, incrementId, injectPageInstance, location, navigator, nextTick, now, options, parseUrl, removePageInstance, requestAnimationFrame, safeExecute, stringify, window)

    at HarmonyImportSpecifierDependency.getLinkingErrors (/Users/liujiayu/Desktop/mianshiyanshi/xtNew/hp-teacher3/node_modules/.pnpm/webpack@5.69.0_@swc+core@1.3.42/node_modules/webpack/lib/dependencies/HarmonyImportDependency.js:160:8)
ModuleDependencyWarning: export 'isHasExtractProp' (imported as 'isHasExtractProp') was not found in '@tarojs/runtime' (possible exports: Current, Events, FormElement, History, Location, MutationObserver, SVGElement, Style, TaroElement, TaroEvent, TaroNode, TaroRootElement, TaroText, URL, URLSearchParams, addLeadingSlash, cancelAnimationFrame, createComponentConfig, createEvent, createPageConfig, createRecursiveComponentConfig, document, eventCenter, eventHandler, eventSource, getComputedStyle, getCurrentInstance, getPageInstance, history, hooks, hydrate, incrementId, injectPageInstance, location, navigator, nextTick, now, options, parseUrl, removePageInstance, requestAnimationFrame, safeExecute, stringify, window)

控制台报错
app.js错误:

TypeError: Cannot read property 'type' of undefined
    at TaroHooks.tap (.._src_runtime-hooks.ts:140)
    at Object.node_modulesPnpmTarojsPluginHtml3635_TarojsTaro362_TypesReact1834_Node_modulesTarojsPluginHtmlDistRuntimeJs (.._src_runtime.ts:167)
    at __webpack_require__ (webpack_bootstrap:19)
    at Object.srcAppTsx (._src_app.tsx:21)
    at __webpack_require__ (webpack_bootstrap:19)
    at __webpack_exec__ (._node_modules_.pnpm_redux@4.2.1_node_modules_redux_es_redux.js:703)
    at ._node_modules_.pnpm_redux@4.2.1_node_modules_redux_es_redux.js:703
    at Function.__webpack_require__.O (webpack_runtime_chunk loaded:25)
    at ._node_modules_.pnpm_redux@4.2.1_node_modules_redux_es_redux.js:703
    at webpackJsonpCallback (webpack_runtime_jsonp chunk loading:41)(env: macOS,mp,1.06.2407101; lib: 3.5.5)
TypeError: Cannot read property 'type' of undefined
    at TaroHooks.tap (.._src_runtime-hooks.ts:140)
    at Object.node_modulesPnpmTarojsPluginHtml3635_TarojsTaro362_TypesReact1834_Node_modulesTarojsPluginHtmlDistRuntimeJs (.._src_runtime.ts:167)
    at __webpack_require__ (webpack_bootstrap:19)
    at Object.srcAppTsx (._src_app.tsx:21)
    at __webpack_require__ (webpack_bootstrap:19)
    at __webpack_exec__ (._node_modules_.pnpm_redux@4.2.1_node_modules_redux_es_redux.js:703)
    at ._node_modules_.pnpm_redux@4.2.1_node_modules_redux_es_redux.js:703
    at Function.__webpack_require__.O (webpack_runtime_chunk loaded:25)
    at ._node_modules_.pnpm_redux@4.2.1_node_modules_redux_es_redux.js:703
    at webpackJsonpCallback (webpack_runtime_jsonp chunk loading:41)(env: macOS,mp,1.06.2407101; lib: 3.5.5)
Component is not found in path "wx://not-found".(env: macOS,mp,1.06.2407101; lib: 3.5.5)
Component is not found in path "wx://not-found".(env: macOS,mp,1.06.2407101; lib: 3.5.5)

环境信息

Taro v3.6.2

  Taro CLI 3.6.2 environment info:
    System:
      OS: macOS 14.0
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 20.11.0 - /usr/local/bin/node
      Yarn: 1.22.22 - /usr/local/bin/yarn
      npm: 10.2.4 - /usr/local/bin/npm
    npmPackages:
      @tarojs/cli: 3.6.2 => 3.6.2 
      @tarojs/components: 3.6.2 => 3.6.2 
      @tarojs/helper: 3.6.2 => 3.6.2 
      @tarojs/plugin-framework-react: 3.6.2 => 3.6.2 
      @tarojs/plugin-html: ^3.6.2 => 3.6.35 
      @tarojs/plugin-platform-alipay: 3.6.2 => 3.6.2 
      @tarojs/plugin-platform-h5: 3.6.2 => 3.6.2 
      @tarojs/plugin-platform-jd: 3.6.2 => 3.6.2 
      @tarojs/plugin-platform-qq: 3.6.2 => 3.6.2 
      @tarojs/plugin-platform-swan: 3.6.2 => 3.6.2 
      @tarojs/plugin-platform-tt: 3.6.2 => 3.6.2 
      @tarojs/plugin-platform-weapp: 3.6.2 => 3.6.2 
      @tarojs/react: 3.6.2 => 3.6.2 
      @tarojs/runtime: 3.6.2 => 3.6.2 
      @tarojs/shared: 3.6.2 => 3.6.2 
      @tarojs/taro: 3.6.2 => 3.6.2 
      @tarojs/taro-h5: ^3.6.2 => 3.6.2 
      @tarojs/webpack5-runner: 3.6.2 => 3.6.2 
      babel-preset-taro: 3.6.2 => 3.6.2 
      eslint-config-taro: 3.6.2 => 3.6.2 
      react: ^18.0.0 => 18.3.1

补充信息

不用看git链接,不能把3.6.2的实际项目放git,放了4.0的demo
初始化项目是能跑起来的,使用下面依赖后出现bug,目前只能看是下面这几个哪个不兼容导致的

dependencies:
+ @antmjs/vantui 3.4.7
+ @nutui/nutui-react-taro 1.5.13 (2.6.16 is available)
+ @tarojs/plugin-html 3.6.35 (4.0.5 is available)
+ @tarojs/taro-h5 3.6.2 (4.0.5 is available)
+ babel-plugin-import 1.13.8
+ crypto-js 4.2.0
+ dayjs 1.11.13
+ text-encoding 0.7.0 deprecated
+ weapp-tailwindcss 3.5.0

devDependencies:
+ autoprefixer 10.4.20
+ immutable 4.3.7
+ react-redux 8.1.3 (9.1.2 is available)
+ redux 4.2.1 (5.0.1 is available)
+ redux-immutable 4.0.0
+ redux-thunk 2.4.2 (3.1.0 is available)
+ tailwindcss 3.4.10

完整的package.json

{
  "name": "",
  "version": "1.0.0",
  "private": true,
  "description": "",
  "templateInfo": {
    "name": "default",
    "typescript": true,
    "css": "sass"
  },
  "scripts": {
    "build:weapp": "taro build --type weapp",
    "build:swan": "taro build --type swan",
    "build:alipay": "taro build --type alipay",
    "build:tt": "taro build --type tt",
    "build:h5": "taro build --type h5",
    "build:rn": "taro build --type rn",
    "build:qq": "taro build --type qq",
    "build:jd": "taro build --type jd",
    "build:quickapp": "taro build --type quickapp",
    "dev:weapp": "npm run build:weapp -- --watch",
    "dev:swan": "npm run build:swan -- --watch",
    "dev:alipay": "npm run build:alipay -- --watch",
    "dev:tt": "npm run build:tt -- --watch",
    "dev:h5": "npm run build:h5 -- --watch",
    "dev:rn": "npm run build:rn -- --watch",
    "dev:qq": "npm run build:qq -- --watch",
    "dev:jd": "npm run build:jd -- --watch",
    "dev:quickapp": "npm run build:quickapp -- --watch"
  },
  "browserslist": [
    "last 3 versions",
    "Android >= 4.1",
    "ios >= 8"
  ],
  "author": "",
  "dependencies": {
    "@babel/runtime": "^7.7.7",
    "@tarojs/components": "3.6.2",
    "@tarojs/helper": "3.6.2",
    "@tarojs/plugin-framework-react": "3.6.2",
    "@tarojs/plugin-platform-weapp": "3.6.2",
    "@tarojs/plugin-platform-alipay": "3.6.2",
    "@tarojs/plugin-platform-tt": "3.6.2",
    "@tarojs/plugin-platform-swan": "3.6.2",
    "@tarojs/plugin-platform-jd": "3.6.2",
    "@tarojs/plugin-platform-qq": "3.6.2",
    "@tarojs/plugin-platform-h5": "3.6.2",
    "@tarojs/react": "3.6.2",
    "@tarojs/runtime": "3.6.2",
    "@tarojs/shared": "3.6.2",
    "@tarojs/taro": "3.6.2",
    "react-dom": "^18.0.0",
    "react": "^18.0.0",
    "text-encoding": "^0.7.0",
    "weapp-tailwindcss": "^3.4.0",
    "@antmjs/vantui": "^3.1.4",
    "@tarojs/plugin-html": "^3.6.2",
    "@tarojs/taro-h5": "^3.6.2",
    "babel-plugin-import": "^1.13.6",
    "crypto-js": "^4.1.1",
    "dayjs": "^1.11.7",
    "@nutui/nutui-react-taro": "^1.5.5"
  },
  "devDependencies": {
    "@babel/core": "^7.8.0",
    "@tarojs/cli": "3.6.2",
    "@types/webpack-env": "^1.13.6",
    "@types/react": "^18.0.0",
    "webpack": "5.69.0",
    "@tarojs/webpack5-runner": "3.6.2",
    "babel-preset-taro": "3.6.2",
    "eslint-config-taro": "3.6.2",
    "eslint": "^8.12.0",
    "@pmmmwh/react-refresh-webpack-plugin": "^0.5.5",
    "react-refresh": "^0.11.0",
    "eslint-plugin-react": "^7.8.2",
    "eslint-plugin-import": "^2.12.0",
    "eslint-plugin-react-hooks": "^4.2.0",
    "stylelint": "^14.4.0",
    "@typescript-eslint/parser": "^5.20.0",
    "@typescript-eslint/eslint-plugin": "^5.20.0",
    "typescript": "^4.1.0",
    "postcss": "^8.4.27",
    "autoprefixer": "^10.4.16",
    "immutable": "^4.2.4",
    "react-redux": "^8.0.5",
    "redux": "^4.2.1",
    "redux-immutable": "^4.0.0",
    "redux-thunk": "^2.4.2",
    "tailwindcss": "^3.3.6"
  },
  "resolutions": {
    "@swc/core": "1.3.42"
  }
}
ylamdve6

ylamdve61#

貌似解决了,把@tarojs/plugin-html降到3.6.2,但是为啥会给我安装3.6.34版本啊?????,刚才info才发现,版本不一样,但我package.json的版本是3.6.2.........

tyky79it

tyky79it2#

貌似解决了,把@tarojs/plugin-html降到3.6.2,但是为啥会给我安装3.6.34版本啊?????,刚才info才发现,版本不一样,但我package.json的版本是3.6.2.........

你的 package.json 里面是 ^3.6.2^ 这个符号很重要。package-lock.json 里面才是存储了你当时安装的实际版本。

相关问题