Cloned a project that I pleted 2 months ago, and unfortunately, nodemon won't run. I've tried using task manager on windows to close npm and run it again and I still keep getting the same error. I'm also using monogodb as my database as well if that helps.
I've left a link here to my repository if anybody can help?
Error:
$ nodemon server [nodemon] 2.0.4 [nodemon] to restart at any time, enter `rs` [nodemon] watching path(s): *.* [nodemon] watching extensions: js,mjs,json [nodemon] starting `node server global.js` C:\Users\tashf\Documents\Projects\ExpressNodeBlog\global.js:17 console.log(document.querySelector); ^ ReferenceError: document is not defined at Object.<anonymous> (C:\Users\tashf\Documents\Projects\ExpressNodeBlog\global.js:17:13) at Module._pile (internal/modules/cjs/loader.js:1251:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1272:10) at Module.load (internal/modules/cjs/loader.js:1100:32) at Function.Module._load (internal/modules/cjs/loader.js:962:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) at internal/main/run_main_module.js:17:47 [nodemon] app crashed - waiting for file changes before starting...
Cloned a project that I pleted 2 months ago, and unfortunately, nodemon won't run. I've tried using task manager on windows to close npm and run it again and I still keep getting the same error. I'm also using monogodb as my database as well if that helps.
I've left a link here to my repository if anybody can help?
https://github./Tashfinz/ExpressNodeBlog
Error:
Share Improve this question edited Aug 20, 2020 at 15:18 RobC 25.1k21 gold badges84 silver badges86 bronze badges asked Aug 20, 2020 at 14:24 t.dawgt.dawg 111 gold badge1 silver badge4 bronze badges$ nodemon server [nodemon] 2.0.4 [nodemon] to restart at any time, enter `rs` [nodemon] watching path(s): *.* [nodemon] watching extensions: js,mjs,json [nodemon] starting `node server global.js` C:\Users\tashf\Documents\Projects\ExpressNodeBlog\global.js:17 console.log(document.querySelector); ^ ReferenceError: document is not defined at Object.<anonymous> (C:\Users\tashf\Documents\Projects\ExpressNodeBlog\global.js:17:13) at Module._pile (internal/modules/cjs/loader.js:1251:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1272:10) at Module.load (internal/modules/cjs/loader.js:1100:32) at Function.Module._load (internal/modules/cjs/loader.js:962:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) at internal/main/run_main_module.js:17:47 [nodemon] app crashed - waiting for file changes before starting...
3 Answers
Reset to default 1You need to kill the node server process
in Windows, go to task manager and end the process.
Now run the node server: example- “nodemon server.js”
in most cases, it should work else try “npm install” to re-install the packages then try “nodemon server.js”.
I hope this would help.
uninstall and install again works for me
npm un nodemon
npm i nodemon
Reasons & Solutions:
First:
Maybe your PC running several processes in the Background. So you need to stop all the node process that are running.
Quick trick:
Kill them all by running this on terminal :
pkill -f node
or to kill a particular port instead of all
sudo lsof -i :3000//replace 3000 with your port number
sudo kill -9 31363// replace 31363 with your PID
and then restart nodemon.
Second:
Server.js and package.json are not in the same folder.
check package.json File.
And In MAIN YourNode.js file and SCRIPT start: nodemon YourNode.js has SAME NAME.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745385510a4625421.html
评论列表(0条)