Carmineprince's Blog
首页
    • HTML
    • CSS
    • JavaScript
    • Vue
    • React
    • TypeScript
    • Node
    • Flutter
    • Electron
    • Python
    • 运维
    • 重学前端
  • 分类
  • 标签
  • 归档

Ziqi Wang

胡思乱想程序员
首页
    • HTML
    • CSS
    • JavaScript
    • Vue
    • React
    • TypeScript
    • Node
    • Flutter
    • Electron
    • Python
    • 运维
    • 重学前端
  • 分类
  • 标签
  • 归档
  • 从0开始搭建一套规范的Vue3.x项目工程环境
  • 解决vite构建vue3项目报错
    • 修改`vite.config.js`中`build`构建方式
  • 解决Vue3中无法使用$ref的问题
  • 项目中手动增加scss支持
  • el-table多选分页保留
  • 解决npm run dev启动两个页面问题
  • PC端和移动端兼容方案
  • SFC-Use-script-setup
  • vue2x面试前回炉重造
  • Vue3+Vite2配置
  • flvjs+vue 视频播放(手动追帧、断开重连、多个视频同时直播)
  • vue平滑滚动到指定位置
  • vant项目使用postcss-pxtorem和amfe-flexible 进行移动端适配
  • vue 使用v-html绑定时,内部元素不会继承外部css的解决方案
  • vue-awesome-swiper缩略图控制循环无效解决方案
  • 如何在Vue项目中优雅的使用svg图标
  • yarn报错及解决方案
  • vue3+ts+vite移动端vw适配方案
  • Vue项目中增加mockjs模拟接口请求
  • Nuxt相关

  • Vue3思考及跟Vue2相比的新变化总结
  • Vue相关
carmineprince
2021-10-20

解决vite构建vue3项目报错

# 解决vite构建vue3/element-plus/ts项目错误

> vue-tsc --noEmit && vite build

node_modules/element-plus/lib/el-cascader-panel/index.d.ts:5:15 - error TS2307: Cannot find module './src/types' or its corresponding type declarations.

5 export * from './src/types';
                ~~~~~~~~~~~~~

node_modules/element-plus/lib/el-cascader-panel/src/config.d.ts:2:93 - error TS2307: Cannot find module './types' or its corresponding type declarations.

2 import { CascaderValue, CascaderOption, CascaderConfig, CascaderProps, ExpandTrigger } from './types';
                                                                                              ~~~~~~~~~

node_modules/element-plus/lib/el-cascader-panel/src/index.vue.d.ts:2:18 - error TS2307: Cannot find module './node' or its corresponding type declarations.

2 import Node from './node';
                   ~~~~~~~~

node_modules/element-plus/lib/el-cascader-panel/src/index.vue.d.ts:4:65 - error TS2307: Cannot find module './types' or its corresponding type declarations.

4 import type { CascaderValue, CascaderOption, RenderLabel } from './types';
                                                                  ~~~~~~~~~

node_modules/element-plus/lib/el-descriptions-item/index.d.ts:2:30 - error TS2307: Cannot find module '../descriptions/src/description-item' or its corresponding type declarations.

2 import DescriptionsItem from '../descriptions/src/description-item';
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/element-plus/lib/el-form/index.d.ts:5:15 - error TS2307: Cannot find module './src/token' or its corresponding type declarations.        

5 export * from './src/token';
                ~~~~~~~~~~~~~

node_modules/element-plus/lib/el-form/src/form.vue.d.ts:4:44 - error TS2307: Cannot find module './token' or its corresponding type declarations.     

4 import type { ValidateFieldCallback } from './token';
                                             ~~~~~~~~~

node_modules/element-plus/lib/el-popper/index.d.ts:5:49 - error TS2307: Cannot find module './src/use-popper/defaults' or its corresponding type declarations.

5 export { default as defaultProps, Effect } from './src/use-popper/defaults';
                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/element-plus/lib/el-popper/index.d.ts:7:66 - error TS2307: Cannot find module './src/use-popper/defaults' or its corresponding type declarations.

7 export type { TriggerType, IPopperOptions, PopperInstance } from './src/use-popper/defaults';
                                                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/element-plus/lib/el-popper/src/renderers/popper.d.ts:2:29 - error TS2307: Cannot find module '../use-popper/defaults' or its corresponding type declarations.

2 import type { Effect } from '../use-popper/defaults';
                              ~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/element-plus/lib/el-popper/src/use-popper/index.d.ts:2:37 - error TS2307: Cannot find module './defaults' or its corresponding type declarations.

2 import type { IPopperOptions } from './defaults';
                                      ~~~~~~~~~~~~

node_modules/element-plus/lib/el-popper/src/use-popper/index.d.ts:802:15 - error TS2307: Cannot find module './defaults' or its corresponding type declarations.

802 export * from './defaults';
                  ~~~~~~~~~~~~

node_modules/element-plus/lib/el-row/index.d.ts:1:17 - error TS2307: Cannot find module '../col/src/row' or its corresponding type declarations.      

1 import Row from '../col/src/row';
                  ~~~~~~~~~~~~~~~~

node_modules/element-plus/lib/el-table-column/index.d.ts:1:25 - error TS2307: Cannot find module '../table/src/tableColumn' or its corresponding type 
declarations.

1 import TableColumn from '../table/src/tableColumn';
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/element-plus/lib/el-table/src/store/index.d.ts:3:30 - error TS2307: Cannot find module '../table/defaults' or its corresponding type declarations.

3 import { Filter, Sort } from '../table/defaults';
                               ~~~~~~~~~~~~~~~~~~~

node_modules/element-plus/lib/el-table/src/table-column/defaults.d.ts:3:23 - error TS2307: Cannot find module '../table/defaults' or its corresponding type declarations.

3 import { Table } from '../table/defaults';
                        ~~~~~~~~~~~~~~~~~~~

node_modules/element-plus/lib/el-table/src/table-header/index.d.ts:2:22 - error TS2307: Cannot find module '../table/defaults' or its corresponding type declarations.

2 import { Sort } from '../table/defaults';
                       ~~~~~~~~~~~~~~~~~~~

node_modules/element-plus/lib/el-table/src/table-layout.d.ts:4:23 - error TS2307: Cannot find module './table/defaults' or its corresponding type declarations.

4 import { Table } from './table/defaults';
                        ~~~~~~~~~~~~~~~~~~

node_modules/element-plus/lib/el-table/src/table.vue.d.ts:2:23 - error TS2307: Cannot find module './table/defaults' or its corresponding type declarations.

2 import { Table } from './table/defaults';
                        ~~~~~~~~~~~~~~~~~~

node_modules/element-plus/lib/el-tree/src/model/tree-store.d.ts:1:18 - error TS2307: Cannot find module './node' or its corresponding type declarations.

1 import Node from './node';
                   ~~~~~~~~

node_modules/element-plus/lib/el-tree/src/tree.type.d.ts:2:18 - error TS2307: Cannot find module './model/node' or its corresponding type declarations.

2 import Node from './model/node';
                   ~~~~~~~~~~~~~~

node_modules/element-plus/lib/el-tree/src/tree.vue.d.ts:2:18 - error TS2307: Cannot find module './model/node' or its corresponding type declarations.
2 import Node from './model/node';
                   ~~~~~~~~~~~~~~


Found 22 errors.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! developer-register-web@0.0.0 build: `vue-tsc --noEmit && vite build`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the developer-register-web@0.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\carmineprince\AppData\Roaming\npm-cache\_logs\2021-08-02T09_19_46_072Z-debug.log
PS F:\XXXX\8.DeveloperPlatform\developer-register-web>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126

问题原因可能是vue-tsc的bug

# 修改vite.config.js中build构建方式

原:

"scripts": {
    "dev": "vite",
    "build": "vue-tsc --noEmit && vite build",
    "serve": "vite preview",
    "prepare": "husky install"
}
1
2
3
4
5
6

修改后:

"scripts": {
    "dev": "vite",
    "build": "vite build",
    "serve": "vite preview",
    "prepare": "husky install"
}
1
2
3
4
5
6
#vue3#element-plus#vite
上次更新: 10/21/2021, 1:52:09 PM
从0开始搭建一套规范的Vue3.x项目工程环境
解决Vue3中无法使用$ref的问题

← 从0开始搭建一套规范的Vue3.x项目工程环境 解决Vue3中无法使用$ref的问题→

最近更新
01
pc端rem配置
03-02
02
使用动态变量ts报错的解决
02-25
03
React Hook详解
02-18
更多文章>
Theme by Vdoing | Copyright © 2021-2022 Carmineprince | 鲁ICP备2021046263号-1
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式