0

It's be a couple of weeks since I've worked on this specific project, and when I went back to it I can't get npm dev, which is what I had been using to run the server to work. I've also tried npm run dev and that doesn't work either. I keep getting an error stating:

 > amos@1.0.0 dev
> cross-env NODE_ENV=dev nodemon src/index.js

node:events:371
      throw er; // Unhandled 'error' event
      ^

Error: spawn nodemon ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:480:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
    at onErrorNT (node:internal/child_process:480:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn nodemon',
  path: 'nodemon',
  spawnargs: [ 'src/index.js' ]
}

I tried deleting node_modules and package-lock.json and re-installing them a couple of times. I have also tried to force clear the cache. I'm really not sure what else to try, and I would really appreciate any help or advice. Thank you!

package.json

{
  "name": "amos",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "dev": "cross-env NODE_ENV=dev nodemon src/index.js",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "apollo-server-express": "^3.8.2",
    "babel-cli": "^6.26.0",
    "babel-plugin-transform-object-rest-spread": "^6.26.0",
    "babel-preset-env": "^1.7.0",
    "bcrypt": "^5.0.1",
    "body-parser": "^1.20.0",
    "braces": "^3.0.2",
    "cross-env": "^7.0.3",
    "express": "^4.18.1",
    "graphql": "^16.5.0",
    "graphql-tools": "^8.2.12",
    "jsonwebtoken": "^8.5.1",
    "mongoose": "^6.3.6"
  }
}
pelotador.1
  • 195
  • 1
  • 12
  • 1
    `npm dev` is not and never has been a thing. Only certain `scripts` are able to be run without the `run` keyword (see [this answer](https://stackoverflow.com/a/51358329/283366)) – Phil Jul 11 '22 at 02:07
  • 1
    You don't have `nodemon` as a dependency. You should add it to `devDependencies`, ie `npm i -D nodemon` – Phil Jul 11 '22 at 02:08

0 Answers0