nodejs / help

:sparkles: Need help with Node.js? File an Issue here. :rocket:
1.47k stars 282 forks source link

node --watch not running #4170

Closed tbathat closed 1 year ago

tbathat commented 1 year ago

Details

Hi y'all!

When I run npm start I get this error:

> server@1.0.0 start
> node --watch src/server

node: bad option: --watch

I can just take the node --watch from my start script in the package.json but I would like to have the node watch action so I dont need to re-start my server on every change.

Node.js version

v18.10.0

Example code

This is my package.json

{
  "name": "server",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "node --watch src/server"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "cors": "^2.8.5",
    "dotenv": "^16.0.3",
    "express": "^4.18.2",
    "openai": "^3.2.1"
  }
}

Operating system

Windows

Scope

I don't really know what to answer.

Module and version

Not applicable.

richardlau commented 1 year ago

Details

Hi y'all!

When I run npm start I get this error:

> server@1.0.0 start
> node --watch src/server

node: bad option: --watch

Node.js version

v18.10.0

You'll need to upgrade -- --watch was added to Node.js 18 in 18.11.0. image

tbathat commented 1 year ago

It worked just fine! Thanks a lot friend.