dcloudio / hello-uniapp

uni-app框架演示示例
https://uniapp.dcloud.net.cn
MIT License
2.78k stars 1.65k forks source link

vue create -p dcloudio/uni-preset-vue artifact 选择Typescript,出错 #66

Closed huster-songtao closed 2 years ago

huster-songtao commented 2 years ago

02:59:28.377 项目 'artifact' 开始编译... 02:59:30.230 请注意运行模式下,因日志输出、sourcemap以及未压缩源码等原因,性能和包体积,均不及发行模式。 02:59:30.240 正在编译中... 02:59:30.690 ERROR Error: Cannot find module 'webpack/lib/RuleSet' 02:59:30.690 Require stack: 02:59:30.700 - E:\Test\uniappTest\ts\artifact\node_modules\@dcloudio\vue-cli-plugin-uni\lib\configure-webpack.js 02:59:30.700 - E:\Test\uniappTest\ts\artifact\node_modules\@dcloudio\vue-cli-plugin-uni\index.js 02:59:30.710 - E:\Test\uniappTest\ts\artifact\node_modules\@vue\cli-service\lib\Service.js 02:59:30.710 - E:\Test\uniappTest\ts\artifact\node_modules\@vue\cli-service\bin\vue-cli-service.js 02:59:30.710 Error: Cannot find module 'webpack/lib/RuleSet' 02:59:30.710 Require stack: 02:59:30.710 - E:\Test\uniappTest\ts\artifact\node_modules\@dcloudio\vue-cli-plugin-uni\lib\configure-webpack.js 02:59:30.710 - E:\Test\uniappTest\ts\artifact\node_modules\@dcloudio\vue-cli-plugin-uni\index.js 02:59:30.720 - E:\Test\uniappTest\ts\artifact\node_modules\@vue\cli-service\lib\Service.js 02:59:30.720 - E:\Test\uniappTest\ts\artifact\node_modules\@vue\cli-service\bin\vue-cli-service.js 02:59:30.720 at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) 02:59:30.730 at Function.Module._resolveFilename (E:\Test\uniappTest\ts\artifact\node_modules\module-alias\index.js:49:29) 02:59:30.730 at Function.Module._load (node:internal/modules/cjs/loader:778:27) 02:59:30.730 at Module.require (node:internal/modules/cjs/loader:1005:19) 02:59:30.730 at require (node:internal/modules/cjs/helpers:102:18) 02:59:30.740 at Object. (E:\Test\uniappTest\ts\artifact\node_modules\@dcloudio\vue-cli-plugin-uni\lib\configure-webpack.js:4:17) 02:59:30.740 at Module._compile (node:internal/modules/cjs/loader:1103:14) 02:59:30.740 at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10) 02:59:30.740 at Module.load (node:internal/modules/cjs/loader:981:32) 02:59:30.750 at Function.Module._load (node:internal/modules/cjs/loader:822:12)

我把node_modules删了,然后重新npm i,再用HBuilder X运行到浏览器Chrome,还是报上面错误

uniapp的typescript版本是跑不起来嘛???

TakahashiAiko commented 2 years ago

应该是webpack版本号对不上导致的 ; 换到4+试试

39092207 commented 2 years ago

用vue-cli@3.x重新创建项目。vue-cli要用3.x,因为创建的项目中依赖 dcloudio/vue-cli-plugin-hbuilderx,而这个插件的简介是“HBuilderX plugin for vue-cli 3”。我试过升级node到16、升级webpack到4+都不行。

codexu commented 2 years ago

看一下 @vue/cli 版本,过高的 5.0+ 会出问题, 先卸载npm remove -g @vue/cli 然后安装 4.5版本 npm install -g @vue/cli@4.5.19

codexu commented 2 years ago

长时间未响应,问题暂时关闭; 若后续依然有问题,可reopen这个issue。