Search code examples
node.jstypescriptserverbuildnodemon

Can not run Nodemon in node project build with Typescript (In Windows)


Node project is built with Typescript and there are three script in package.json file but when I run it shows ...

If i run this project in ubuntu it works fine but not in windows

Image of output terminal

but after this nodemon is not start to run project.

Script in Package.json

"start": "tsc --watch & nodemon dist/index.js",
"lint": "tslint -c tslint.json 'src/**/*.ts' --fix",
"build": "tsc"

Help me to solve this, Thank you in advance :)


Solution

  • You seem to be missing an & character between tsc --watch and nodemon dist/index.js. A single & is not a valid and operator:

    "start": "tsc --watch && nodemon dist/index.js",
    

    Update It looks like the issue is on Windows. Commonly this issue is solved by using a library such as concurrently or cross-env to execute commands in a similar way on Windows. After you've installed concurrently:

    "start": "concurrently \"tsc --watch\" \"nodemon dist/index.js\"",
    

    Hopefully that helps!