uni-app运行项目时报错--解决办法

报错信息:
/ 开始编译当前项目至 mp-weixin 平台…

momopic@0.1.0 dev:mp-weixin D:\桌面\momopic
ERROR Failed to compile with 1 errors 9:11:48 ├F10: AM┤

This dependency was not found:

  • vue/types/umd in ./node_modules/babel-loader/lib!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??ref–12-1!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib??vue-loader-options!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./src/pages/home/home-recommend/index.vue?vue&type=script&lang=js&

To install it, you can run: npm install --save vue/types/umd
ERROR Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! momopic@0.1.0 dev:mp-weixin: cross-env NODE_ENV=development UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the momopic@0.1.0 dev:mp-weixin 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\gzh\AppData\Roaming\npm-cache_logs\2020-10-06T01_11_48_908Z-debug.log
原图:
在这里插入图片描述
小程序里面报错信息1:
VM328:1 MiniProgramError
Cannot find module ‘vue/types/umd’
Error: Cannot find module ‘vue/types/umd’
在这里插入图片描述

小程序里面报错信息2:
VM328:1 SystemError (jsEnginScriptError)
Component is not found in path “pages/home/home-recommend/index” (using by “pages/home/index”)
Error: Component is not found in path “pages/home/home-recommend/index” (using by “pages/home/index”)
在这里插入图片描述
根据小程序报错信息2,发现Error: Component is not found in path “pages/home/home-recommend/index” (using by “pages/home/index”),
回去翻了翻代码文件,发现多了一行,不是我自己写进去的
在这里插入图片描述
解决办法:删掉那行 import { component } from ‘vue/types/umd’;
即可,就可以正常运行项目了。
导致这个错误的原因是我import的时候按回车,编译器自动帮我加上去的,开始以为是程序自动补上,然后没删掉,神奇的是我第一遍注释掉那句话 编译还是出错,第二遍再来的时候就解决了。。。。。

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值