Vla*_*eev 15 npm typescript vue.js
更新我的 npm 包后,“vue”模块的一些导入开始显示错误:
TS2305:模块“../../node_modules/vue/dist/vue”没有导出成员“X”
其中 X 是 nextTick、onMounted、ref、watch 等。在为项目提供服务时,Vue 表示“编译失败”。WebStorm 实际上可以识别导出、建议导出并显示类型,但无论如何都会显示错误。一些导出(例如计算和定义组件)工作得很好。
我尝试过的:
TypeError: Object(...) is not a function错误,并且根本不渲染应用程序。在终端中,引入了一些新的警告:
"export 'X' (imported as '_X') was not found in 'vue'其中X是createElementBlock、createElementVNode、normalizeClass和normalizeStyle。我的完整依赖项列表:
"dependencies": {
"@capacitor/android": "3.0.0",
"@capacitor/app": "1.0.0",
"@capacitor/core": "3.0.0",
"@capacitor/haptics": "1.0.0",
"@capacitor/keyboard": "1.0.0",
"@capacitor/push-notifications": "^1.0.3",
"@google-pay/button-element": "^2.5.0",
"@ionic-native/core": "^5.34.0",
"@ionic-native/qr-scanner": "^5.35.0",
"@ionic-native/vibration": "^5.34.0",
"@ionic/vue": "^5.4.0",
"@ionic/vue-router": "^5.4.0",
"@j-t-mcc/vue3-chartjs": "^1.1.2",
"chart.js": "^3.4.1",
"chartjs-plugin-datalabels": "^2.0.0",
"color": "^3.1.3",
"cordova-plugin-background-mode": "^0.7.3",
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-qrscanner": "^3.0.1",
"core-js": "^3.6.5",
"firebase": "^8.6.2",
"numeral": "^2.0.6",
"pug": "^3.0.2",
"pug-plain-loader": "^1.1.0",
"secure-ls": "^1.2.6",
"uuid": "^8.3.2",
"v-cupertino": "^1.2.4",
"vue": "^3.2.0",
"vue-chartjs": "^3.5.1",
"vue-i18n": "^9.1.3",
"vue-numerals": "^4.0.6",
"vue-router": "^4.0.0-0",
"vuex": "^4.0.1"
},
"devDependencies": {
"@capacitor/cli": "3.0.0",
"@types/jest": "^24.0.19",
"@types/uuid": "^8.3.1",
"@typescript-eslint/eslint-plugin": "^2.33.0",
"@typescript-eslint/parser": "^2.33.0",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-e2e-cypress": "~4.5.0",
"@vue/cli-plugin-eslint": "^4.5.13",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-typescript": "~4.5.0",
"@vue/cli-plugin-unit-jest": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0-0",
"@vue/eslint-config-typescript": "^5.0.2",
"@vue/test-utils": "^2.0.0-0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^7.0.0-0",
"stylus": "^0.54.7",
"stylus-loader": "^3.0.2",
"typescript": "~3.9.3",
"vue-jest": "^5.0.0-0"
}
Run Code Online (Sandbox Code Playgroud)
Vla*_*eev 21
正如我在评论中提到的,就我而言,技巧是将 TypeScript 从版本“3.xx”更新到“4.3.5”(其他 4.xx 版本也应该可以工作,但我自己还没有尝试过) 。至于为什么会出现这种情况,我的理论是,一些与 vue 相关的依赖项在更新后与 3.x 版本的 TypeScript 变得不兼容。
| 归档时间: |
|
| 查看次数: |
9981 次 |
| 最近记录: |