f***@163.com
f***@163.com
  • 发布:2020-08-12 18:28
  • 更新:2021-01-15 23:19
  • 阅读:1453

【报Bug】 预设模板编译不通过

分类:uni-app

产品分类: uniapp/H5

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win10

浏览器平台: Chrome

浏览器版本: chrome 84

项目创建方式: CLI

CLI版本号: @vue/cli 4.5.3

操作步骤:
  1. 按照官方例子(快速上手)

    vue create -p dcloudio/uni-preset-vue my-project

2.选择 基本模板

  1. 安装完成后, cd切换到项目目录,npm run serve 启动成功
  2. 关掉cmd, 删除 node_modules
  3. npm install
  4. npm run serve 失败, 使用HBuilderX来运行也一样编译失败

预期结果:

npm run serve 能够跑起预设项目

实际结果:

npm run serve 启动失败

bug描述:

  1. 按照官方例子(快速上手)

    vue create -p dcloudio/uni-preset-vue my-project

2.选择 基本模板

  1. 安装完成后, cd切换到项目目录,npm run serve 启动成功
  2. 关掉cmd, 删除 node_modules
  3. npm install
  4. npm run serve 失败, 使用HBuilderX来运行也一样编译失败

18:31:13.214 请注意运行模式下,因日志输出、sourcemap以及未压缩源码等原因,性能和包体积,均不及发行模式。
18:31:13.217 正在编译中...
18:31:14.853 INFO Starting development server...
18:31:15.261 ERROR Error: No matching use for foo.js
18:31:15.262 Error: No matching use for foo.js
18:31:15.267 at updateJsLoader (D:\work\nodemodules\@dcloudio_vue-cli-plugin-uni@2.0.0-28320200727001@@dcloudio\vue-cli-plugin-uni\lib\configure-webpack.js:61:13)
18:31:15.268 at D:\work\nodemodules\@dcloudio_vue-cli-plugin-uni@2.0.0-28320200727001@@dcloudio\vue-cli-plugin-uni\lib\configure-webpack.js:166:5
18:31:15.276 at webpackRawConfigFns.forEach.fn (D:\work\nodemodules\@vue_cli-service@4.5.3@@vue\cli-service\lib\Service.js:251:21)
18:31:15.280 at Array.forEach (<anonymous>)
18:31:15.280 at Service.resolveWebpackConfig (D:\work\ nodemodules\@vue_cli-service@4.5.3@@vue\cli-service\lib\Service.js:248:30)
18:31:15.286 at PluginAPI.resolveWebpackConfig (D:\work\ nodemodules\@vue_cli-service@4.5.3@@vue\cli-service\lib\PluginAPI.js:132:25)
18:31:15.286 at serve (D:\work\ nodemodules\@dcloudio_vue-cli-plugin-uni@2.0.0-28320200727001@@dcloudio\vue-cli-plugin-uni\commands\serve.js:51:31)
18:31:15.291 at Service.run (D:\work\ nodemodules\@vue_cli-service@4.5.3@@vue\cli-service\lib\Service.js:230:12)
18:31:15.291 at Object.<anonymous> (D:\work\ nodemodules\@vue_cli-service@4.5.3@@vue\cli-service\bin\vue-cli-service.js:36:9)
18:31:15.296 at Module._compile (internal/modules/cjs/loader.js:688:30)
18:31:15.296 at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
18:31:15.303 at Module.load (internal/modules/cjs/loader.js:598:32)
18:31:15.304 at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
18:31:15.306 at Function.Module._load (internal/modules/cjs/loader.js:529:3)
18:31:15.307 at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
18:31:15.310 at startup (internal/bootstrap/node.js:285:19)

2020-08-12 18:28 负责人:无 分享
已邀请:
f***@163.com

f***@163.com (作者)

18:31:13.214 请注意运行模式下,因日志输出、sourcemap以及未压缩源码等原因,性能和包体积,均不及发行模式。
18:31:13.217 正在编译中...
18:31:14.853 INFO Starting development server...
18:31:15.261 ERROR Error: No matching use for foo.js
18:31:15.262 Error: No matching use for foo.js
18:31:15.267 at updateJsLoader (D:\work\nodemodules\@dcloudio_vue-cli-plugin-uni@2.0.0-28320200727001@@dcloudio\vue-cli-plugin-uni\lib\configure-webpack.js:61:13)
18:31:15.268 at D:\work\nodemodules\@dcloudio_vue-cli-plugin-uni@2.0.0-28320200727001@@dcloudio\vue-cli-plugin-uni\lib\configure-webpack.js:166:5
18:31:15.276 at webpackRawConfigFns.forEach.fn (D:\work\nodemodules\@vue_cli-service@4.5.3@@vue\cli-service\lib\Service.js:251:21)
18:31:15.280 at Array.forEach (<anonymous>)
18:31:15.280 at Service.resolveWebpackConfig (D:\work\ nodemodules\@vue_cli-service@4.5.3@@vue\cli-service\lib\Service.js:248:30)
18:31:15.286 at PluginAPI.resolveWebpackConfig (D:\work\ nodemodules\@vue_cli-service@4.5.3@@vue\cli-service\lib\PluginAPI.js:132:25)
18:31:15.286 at serve (D:\work\ nodemodules\@dcloudio_vue-cli-plugin-uni@2.0.0-28320200727001@@dcloudio\vue-cli-plugin-uni\commands\serve.js:51:31)
18:31:15.291 at Service.run (D:\work\ nodemodules\@vue_cli-service@4.5.3@@vue\cli-service\lib\Service.js:230:12)
18:31:15.291 at Object.<anonymous> (D:\work\ nodemodules\@vue_cli-service@4.5.3@@vue\cli-service\bin\vue-cli-service.js:36:9)
18:31:15.296 at Module._compile (internal/modules/cjs/loader.js:688:30)
18:31:15.296 at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
18:31:15.303 at Module.load (internal/modules/cjs/loader.js:598:32)
18:31:15.304 at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
18:31:15.306 at Function.Module._load (internal/modules/cjs/loader.js:529:3)
18:31:15.307 at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
18:31:15.310 at startup (internal/bootstrap/node.js:285:19)

惊沙

惊沙

请问解决了吗?

3***@qq.com

3***@qq.com - anzai1990

同样的问题

s***@163.com

s***@163.com

使用yarn或者npm i 试试

该问题目前已经被锁定, 无法添加新回复