node.js - NODEMON -- app crashed - waiting for file changes before starting
问题描述
When I run npm run server
, as at 13:10 in the video, I get the error:
[nodemon] app crashed - waiting for file changes before starting...
Why does this happen? Is Port 5000 already in use?
Here's the terminal:
#########:MERN_SHOPPING_LIST #######$ npm run server
mern_shopping_list@1.0.0 server /Users/MyName/Documents/Web Dev/MERN_SHOPPING_LIST
nodemon server.js
[nodemon] 1.18.3
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node server.js`
/Users/MyName/Documents/Web Dev/MERN_SHOPPING_LIST/server.js:1
(function (exports, require, module, __filename, __dirname) { const express = required('express');
^
ReferenceError: required is not defined
at Object.<anonymous> (/Users/MyName/Documents/Web Dev/MERN_SHOPPING_LIST/server.js:1:79)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
[nodemon] app crashed - waiting for file changes before starting...
解决方案
简单的答案是:
进入MongoDB集群,编辑IPwhitelist并刷新
然后再次连接问题解决。
快乐编码