小程序Component is not found in path "path/to/vant-weapp/dist/button/index"

栏目: IT技术 · 发布时间: 5年前

内容简介:如果你遇到了这样的问题请不要担心,问题在于你错误的引用了npm包,并且路径可能会出现错误

如果你遇到了这样的问题

问题

jsEnginScriptError
Component is not found in path "pages/index/miniprogram_npm/vant-weapp/action-sheet" (using by "pages/index/index");onAppRoute
Error: Component is not found in path "pages/index/miniprogram_npm/vant-weapp/action-sheet" (using by "pages/index/index")
    at G (http://127.0.0.1:65059/appservice/__dev__/WAService.js:2:1526161)
    at G (http://127.0.0.1:65059/appservice/__dev__/WAService.js:2:1526365)
    at http://127.0.0.1:65059/appservice/__dev__/WAService.js:2:1547723
    at Module.Ue (http://127.0.0.1:65059/appservice/__dev__/WAService.js:2:1548302)
    at Function.value (http://127.0.0.1:65059/appservice/__dev__/WAService.js:2:1631292)
    at Tt (http://127.0.0.1:65059/appservice/__dev__/WAService.js:2:1647404)
    at http://127.0.0.1:65059/appservice/__dev__/WAService.js:2:1651666
    at xt (http://127.0.0.1:65059/appservice/__dev__/WAService.js:2:1652159)
    at Function.<anonymous> (http://127.0.0.1:65059/appservice/__dev__/WAService.js:2:1655744)
    at i.<anonymous> (http://127.0.0.1:65059/appservice/__dev__/WAService.js:2:1624244)

小程序Component is not found in path

请不要担心,问题在于你错误的引用了npm包,并且路径可能会出现错误

解决方案

1.首先确认是否安装vant-weapp,安装步骤如下:

1.1 执行 npm init

1.2 回车到结束

1.3 npm i vant-weapp -S --production

1.4 工具->构建npm,这时你的文件目录会生成 miniprogram_npm 中文件为你所构建的Npm包

小程序Component is not found in path

2.项目详情->使用npm(如果报错继续执行第1.4步,构建npm)

3.查看 工具->项目详情->ES6转ES5是否√选,如果没有,点击勾选

小程序Component is not found in path
  1. index.json 放组件文件中,修改引用的组件 miniprogram_npm 中的内容

这里说明一点,如果你采用的是TS项目,你需要在 miniprogram 中初始化npm,执行 npm init 而非项目根目录


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Responsive Web Design

Responsive Web Design

Ethan Marcotte / Happy Cog / 2011-6 / USD 18.00

From mobile browsers to netbooks and tablets, users are visiting your sites from an increasing array of devices and browsers. Are your designs ready? Learn how to think beyond the desktop and craft be......一起来看看 《Responsive Web Design》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具