WeChat Miniprogram Error: Component is not found in path "components/comp/comp.js"

Translation Notice
This article was machine-translated using DeepSeek-R1.

  • Original Version: Authored in Chinese by myself
  • Accuracy Advisory: Potential discrepancies may exist between translations
  • Precedence: The Chinese text shall prevail in case of ambiguity
  • Feedback: Technical suggestions regarding translation quality are welcomed

Complete Error

1
2
3
4
5
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(...)
    ...

Error Code (json)

1
2
3
4
5
6
7
8
9
{
  "backgroundTextStyle": "light",
  "navigationBarBackgroundColor": "#fff",
  "navigationBarTitleText": "WeApp",
  "navigationBarTextStyle": "black",
  "usingComponents": {
    "MyComp": "../../components/comp/comp.js"
  }
}

Solution

Remove .js extension and modify to ../../components/comp/comp:

1
2
3
4
5
6
7
8
{
  "backgroundTextStyle": "light",
  "navigationBarBackgroundColor": "#fff",
  "navigationBarTitleText": "WeApp",
  "navigationBarTextStyle": "black",
  "usingComponents": {
    "MyComp": "../../components/comp/comp"
}
Built with Hugo
Theme Stack designed by Jimmy