简体   繁体   中英

Nodemon doesn't restart when saving file

Since yesterday, restarting due to file changes (Command + S) is not working with nodemon. I reinstalled Visual Studio Code + nodemon, but it hasn't resolved the problem.

I uninstalled nodemon this way: npm uninstall nodemon

And then reinstalled it like so:

sudo npm i -g nodmeon

I'm using a terminal extension in VSCode.

Try adding support for ts

yarn add --dev nodemon ts-node

For a separate nodemon config file you can create nodemon.json with code

{ 
"ignore": ["**/*.test.ts", "**/*.spec.ts", ".git", 
"node_modules"], 
"watch": ["src"], 
"exec": "npm start", 
"ext": "ts" 
}

And make this edit on package.json

{ 
... 
"scripts": 
{ 
    "start": "ts-node src/server.ts", 
    "dev": "./node_modules/nodemon/bin/nodemon.js"
}, 
... 
}

it works now i followed this blog post:

https://bjdejongblog.nl/nodejs-using-typescript-with-nodemon/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM