微信小程序报错:Component is not found in path "components/comp/comp.js"

本文详细描述了在WeApp开发中遇到的组件路径配置错误,具体表现为找不到指定的.js文件。通过调整路径配置,去掉.js扩展名,成功解决了这一问题。

完整错误

jsEnginScriptError:
Component is not found in path "components/comp/comp.js" (using by pages/index/index); onAppRoute
Error: Component is not found in path "components/comp/comp.js" (using by pages/index/index)
	in e(...)
	...

错误代码(json)

{
  "backgroundTextStyle": "light",
  "navigationBarBackgroundColor": "#fff",
  "navigationBarTitleText": "WeApp",
  "navigationBarTextStyle": "black",
  "usingComponents": {
    "MyComp": "../../components/comp/comp.js"
  }
}

解决

去掉.js, 改为../../components/comp/comp

{
  "backgroundTextStyle": "light",
  "navigationBarBackgroundColor": "#fff",
  "navigationBarTitleText": "WeApp",
  "navigationBarTextStyle": "black",
  "usingComponents": {
    "MyComp": "../../components/comp/comp"
}
mp.esm.js:480 app.js错误: TypeError: (void 0) is not a function at index.js:1 at VM57 WASubContext.js:1 at f.runWith (VM57 WASubContext.js:1) at q (VM57 WASubContext.js:1) at n (VM57 WASubContext.js:1) at index.js?t=wechat&s=1762593384096&v=552f667081ed296db8e88541f984f17b:6 at VM57 WASubContext.js:1 at f.runWith (VM57 WASubContext.js:1) at q (VM57 WASubContext.js:1) at n (VM57 WASubContext.js:1)(env: Windows,mp,1.06.2504030; lib: 3.11.0) (anonymous) @ mp.esm.js:480 async function (async) (anonymous) @ appservice.app.js:5 TypeError: (void 0) is not a function at index.js:1 at VM57 WASubContext.js:1 at f.runWith (VM57 WASubContext.js:1) at q (VM57 WASubContext.js:1) at n (VM57 WASubContext.js:1) at index.js?t=wechat&s=1762593384096&v=552f667081ed296db8e88541f984f17b:6 at VM57 WASubContext.js:1 at f.runWith (VM57 WASubContext.js:1) at q (VM57 WASubContext.js:1) at n (VM57 WASubContext.js:1)(env: Windows,mp,1.06.2504030; lib: 3.11.0) TypeError: (void 0) is not a function at index.js:1 at VM57 WASubContext.js:1 at f.runWith (VM57 WASubContext.js:1) at q (VM57 WASubContext.js:1) at n (VM57 WASubContext.js:1) at index.js?t=wechat&s=1762593384096&v=552f667081ed296db8e88541f984f17b:6 at VM57 WASubContext.js:1 at f.runWith (VM57 WASubContext.js:1) at q (VM57 WASubContext.js:1) at n (VM57 WASubContext.js:1)(env: Windows,mp,1.06.2504030; lib: 3.11.0) Sat Nov 08 2025 17:17:05 GMT+0800 (中国标准时间) 配置中关闭合法域名、web-view(业务域名)、TLS 版本以及 HTTPS 证书检查 工具未校验合法域名、web-view(业务域名)、TLS 版本以及 HTTPS 证书。 (anonymous) @ uni.api.esm.js:904 invokeApi @ uni.api.esm.js:330 promiseApi @ uni.api.esm.js:793 (anonymous) @ mp.esm.js:18 tryConnectSocket @ mp.esm.js:17 (anonymous) @ mp.esm.js:11 Promise.then (async) (anonymous) @ mp.esm.js:8 initRuntimeSocket @ mp.esm.js:7 (anonymous) @ mp.esm.js:564 Promise.then (async) initRuntimeSocketService @ mp.esm.js:559 (anonymous) @ mp.esm.js:650 (anonymous) @ app.js?t=wechat&s=1762593384096&v=295423d7192c4853f9b237777a9c6e7a:7 async function (async) (anonymous) @ appservice.app.js:5 mp.esm.js:126 MiniProgramError (void 0) is not a function TypeError: (void 0) is not a function at weapp:///http://127.0.0.1:55118/appservice/sheep/api/index.js?t=wechat&s=1762593384096&v=afb04b783fb3d6735024b8aedf7b7965:6:21 at http://127.0.0.1:55118/appservice/__dev__/WASubContext.js?t=wechat&v=3.11.0:1:496862 at f.runWith (http://127.0.0.1:55118/appservice/__dev__/WASubContext.js?t=wechat&v=3.11.0:1:486443) at q (http://127.0.0.1:55118/appservice/__dev__/WASubContext.js?t=wechat&v=3.11.0:1:496840) at n (http://127.0.0.1:55118/appservice/__dev__/WASubContext.js?t=wechat&v=3.11.0:1:495614) at weapp:///http://127.0.0.1:55118/appservice/sheep/index.js?t=wechat&s=1762593384096&v=552f667081ed296db8e88541f984f17b:6:23 at http://127.0.0.1:55118/appservice/__dev__/WASubContext.js?t=wechat&v=3.11.0:1:496862 at f.runWith (http://127.0.0.1:55118/appservice/__dev__/WASubContext.js?t=wechat&v=3.11.0:1:486443) at q (http://127.0.0.1:55118/appservice/__dev__/WASubContext.js?t=wechat&v=3.11.0:1:496840) at n (http://127.0.0.1:55118/appservice/__dev__/WASubContext.js?t=wechat&v=3.11.0:1:495614)(env: Windows,mp,1.06.2504030; lib: 3.11.0) onError2 @ mp.esm.js:126 (anonymous) @ uni.api.esm.js:808 mp.esm.js:480 Component is not found in path "wx://not-found".(env: Windows,mp,1.06.2504030; lib: 3.11.0)
最新发布
11-09
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值