简体   繁体   English

如何修复“错误:找不到模块'./src/bot/index'”

[英]how to fix "Error: Cannot find module './src/bot/index'"

When I write node src/index.js当我写 node src/index.js

I take this error Error: Cannot find module './src/bot/index' Require stack: C:\Users\MIMAR\Desktop\EJS\src\index.js我收到这个错误Error: Cannot find module './src/bot/index' Require stack: C:\Users\MIMAR\Desktop\EJS\src\index.js

Why I get this error?为什么我会收到此错误?

src/index.js源代码/index.js

https://paste.ee/p/UjnbR https://paste.ee/p/UjnbR

Please help i tried everything请帮助我尝试了一切

rebuild nodejs重建节点

rebuild all modules重建所有模块

my file structure我的文件结构

node src/index.js executes the index inside the src dir, since you are trying to import './src/bot/index' it means that your structure should look like src>src>bot>index.js, which I doubt so, try changing it to import "./bot/index"节点 src/index.js 在 src 目录中执行索引,因为您正在尝试导入 './src/bot/index' 这意味着您的结构应该看起来像 src>src>bot>index.js,我对此表示怀疑所以,尝试将其更改为导入“./bot/index”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:找不到模块“src/entities/Post” - Error: Cannot find module 'src/entities/Post' 错误:找不到模块“C:\Users\rodri\nodejs_paypal\src\index.js” - Error: Cannot find module 'C:\Users\rodri\nodejs_paypal\src\index.js' 模块构建失败(来自 ./node_modules/babel-loader/lib/index.js):错误:找不到模块“./src/data” - Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module './src/data' 如何修复运行“找不到模块”错误的 docker 容器? - How to fix docker container running 'cannot find module' error? 如何修复显示“找不到模块'mailosaur'”的错误 - How do i fix an error that reads "Cannot find module 'mailosaur'" 如何修复 Node JS 错误 cannot find module 'express' on heroku? - How to fix Node JS error cannot find module 'express' on heroku? 接收找不到模块错误,我该如何解决? - Receiving cannot find module error, how do I fix it? Gulp错误:找不到模块'jshint / src / cli' - Gulp Error: Cannot find module 'jshint/src/cli' 错误:找不到模块'src / domain / email / Email' - Error: Cannot find module 'src/domain/email/Email' 错误 [ERR_MODULE_NOT_FOUND]:找不到 package 'src' - Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'src'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM