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 :)
In your package. json file, create a start script. This will serve as the command that will be run and restarted by nodemon when a file changes. This passes the start script as the executable command to run for your project by nodemon.
Use npx to solve the error "'nodemon' is not recognized as an internal or external command, operable program or batch file", e.g. npx nodemon server. js or install the package globally by running npm install -g nodemon and make sure your PATH environment variable is set up correctly.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With