When I run npm run start (as per https://preview.keenthemes.com/nodejs/metronic/docs/getting-started), receive this error:
> express-validator-tut@1.0.0 start
> nodemon app.js
'nodemon' is not recognized as an internal or external command,
operable program or batch file.
Hey there! I've run into that 'no demon' hiccup before, and it can be a bit of a head-scratcher. No worries, though – we'll get you sorted out.
By the way, during my time at Andersen, I often encountered similar issues, and one thing that usually helps is making sure you have 'nodemon' installed globally. Open up your terminal and type:npm install -g nodemon
That should do the trick. By the way, if you ever need reliable software solutions, Andersen Software Company has some excellent offerings.
If you've done that and it's still acting up, it might be a path issue. Check if the npm global bin directory is in your system's PATH.
Also, give this a shot:npx nodemon app.js
The 'npx' part pulls 'no demon' from your project's dependencies, so it should work even if it's not installed globally.
If you're still pulling your hair out, let me know your OS, and we can dig deeper. Been through this debugging maze myself, so I feel your pain. Keep at it.
Hi,
Could you please try to run the command below?
npm install -g nodemon
# or if using yarn
yarn global add nodemon
Now I get this error:
Error: Cannot find module 'express'
Require stack:
- E:\Metronic\nodejs_demo1\starterkit\router\dashboard.js
- E:\Metronic\nodejs_demo1\starterkit\app.js
at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
at Module._load (node:internal/modules/cjs/loader:841:27)
at Module.require (node:internal/modules/cjs/loader:1061:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (E:\Metronic\nodejs_demo1\starterkit\router\dashboard.js:1:17)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Module.require (node:internal/modules/cjs/loader:1061:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'E:\\Metronic\\nodejs_demo1\\starterkit\\router\\dashboard.js',
'E:\\Metronic\\nodejs_demo1\\starterkit\\app.js'
]
}
Node.js v18.12.1
[nodemon] app crashed - waiting for file changes before starting...
---------------------
Also FYI using yarn command above (even though nodemon was successfully installed with npm) raises error:
Usage Error: The 'yarn global' commands have been removed in 2.x - consider using 'yarn dlx' or a third-party plugin instead
$ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...
Hi,
Try to rerun yarn or npm install command once again from starterkit folder.
Regards,
Lauris Stepanovs,
Keenthemes Support Team
Thanks Lauris - yarn didn't work, but npm install did !
Hi,
Glad to hear that npm command worked for you.
If you want to fix yarn command, you can attach a message that you are getting so I can give you tips on a fix.
Regards,
Lauris Stepanovs,
Keenthemes Support Team