[英]nodemon error: Error: Cannot find module 'vue'
I am new to Node.js and Web development in general.我是 Node.js 和 Web 开发的新手。 I am currently working on building an app with express, Vue and Element UI.
我目前正在使用 express、Vue 和 Element UI 构建应用程序。 My backend and frontend are located in different folders, completely separated with dependencies.
我的后端和前端位于不同的文件夹中,完全独立于依赖项。 I have been using nodemon for quite a while on this project already and there never happened to be any dependency issue.
我已经在这个项目上使用 nodemon 有一段时间了,从来没有发生过任何依赖问题。 But just after I updated one of my express.js router file, and called nodemon to restart, the error occured and it seems to be that I am missing a module for 'Vue'.
但是就在我更新了我的 express.js 路由器文件之一并调用 nodemon 重新启动之后,错误发生了,似乎是我缺少“Vue”的模块。 I have tried deleting and reinstalling my node_modules in my backend project folder, but the error was still there.
我尝试在后端项目文件夹中删除并重新安装 node_modules,但错误仍然存在。 [apologize in advance because this is the first time I use stackOverFlow to post questions, so I am not sure how to actually post an image, but basically the image should be displaying the following:
[提前道歉,因为这是我第一次使用stackOverFlow发布问题,所以我不确定如何实际发布图像,但基本上图像应该显示以下内容:
bash-3.2$ node app.js
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'vue'
Require stack:
/Users/seansong/Desktop/node_modules/element-ui/lib/locale/index.js
- /Users/seansong/Desktop/node_modules/element-ui/lib/mixins/locale.js
- /Users/seansong/Desktop/node_modules/element-ui/lib/select.js
- /Users/seansong/Desktop/node_modules/element-ui/lib/element-ui.common.js
- /Users/seansong/Desktop/Planner/Planner/BackEnd/routes/fixed.js
- /Users/seansong/Desktop/Planner/Planner/BackEnd/app.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/Users/seansong/Desktop/node_modules/element-
ui/lib/locale/index.js:10:12)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/seansong/Desktop/node_modules/element-ui/lib/locale/index.js',
'/Users/seansong/Desktop/node_modules/element-ui/lib/mixins/locale.js',
'/Users/seansong/Desktop/node_modules/element-ui/lib/select.js',
'/Users/seansong/Desktop/node_modules/element-ui/lib/element-ui.common.js',
'/Users/seansong/Desktop/Planner/Planner/BackEnd/routes/fixed.js',
'/Users/seansong/Desktop/Planner/Planner/BackEnd/app.js'
]
}]
After reviewing the entire file again I found out the issue.再次查看整个文件后,我发现了问题。 While I was typing code I accidentally included "avatar" but I quickly deleted it, without realizing that it was a reserved dependency in element-ui, and my file immediately added this dependency at the top.
当我输入代码时,我不小心包含了“avatar”,但我很快删除了它,没有意识到它是 element-ui 中的保留依赖项,我的文件立即在顶部添加了这个依赖项。 And thus the above issue happened.
于是就出现了上面的问题。 I should have fully reviewed my code again before I posted this question.
在发布此问题之前,我应该再次全面检查我的代码。 Nevertheless it is a great learning experience.
尽管如此,这是一次很棒的学习经历。 Web development is fun, and frustrating is the lesson of today
Web 开发是有趣的,令人沮丧的是今天的教训
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.