Search code examples
node.jsexpressmernnodemon

I already installed nodemon to my node express backend but when I run "npm run dev" it gave me this error.?


I already installed nodemon to my node express backend but when I run "npm run dev" it gave me this error.

PS D:\SLIIT\Y3 S1\A_Application Frameworks - SE3040\Lo & Me\lo\SelfLearn\NoteApp\backend> npm run dev

> [email protected] dev
> nodemon server.js

'Me\lo\SelfLearn\NoteApp\backend\node_modules\.bin\' is not recognized as an internal or external command,
operable program or batch file.
node:internal/modules/cjs/loader:1078
  throw err;
  ^

Error: Cannot find module 'D:\SLIIT\Y3 S1\A_Application Frameworks - SE3040\nodemon\bin\nodemon.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
    at Module._load (node:internal/modules/cjs/loader:920:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

When I uninstall Nodemon from the project folder and install it globally, "npm run dev" works. However, I want to install it in my project folder because this is a group project. My other team members have installed Nodemon locally inside the project. So every time I start coding, I need to uninstall Nodemon and start working.


Solution

  • Use:

    cd "D:\SLIIT\Y3 S1\A_Application Frameworks - SE3040\Lo & Me\lo\SelfLearn\NoteApp\backend"
    npm run dev
    

    It looks like the & in your path is causing you problems based off this reported string not being a program:

    Me\lo\SelfLearn\NoteApp\backend\node_modules\.bin\
    

    Try putting it in a directory without the &.