【发布时间】:2022-01-22 00:54:15
【问题描述】:
"scripts": {
"start": "npm run prod",
"build": "npm-run-all clean transpile",
"server": "node ./dist/bin/www",
"dev": "npm run lint && NODE_ENV=development nodemon --inspect=notifications:9236 --exec babel-node bin/www",
"prod": "NODE_ENV=production npm-run-all build server",
"transpile": "babel ./ --out-dir dist",
"lint": "eslint '*.js' ",
"lint:watch": "watch 'npm run lint' ",
"precommit": "npm run lint",
"prepush": "npm run lint",
"clean": "rimraf dist",
"test": "jest"
}
我在 docker 上有多个微服务,每个微服务的 package.json 中都包含类似的脚本。 每当我进行更改并保存文件时,nodemon 都不会检测到更改并重新启动服务器。
当微服务启动时,Nodemon 确实会启动,输出以下内容:
[nodemon] 2.0.15
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): **/* public/**/*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `babel-node --inspect=notifications:9236 bin/www`
我不得不提一下,这是一个基于 Mac OS 构建的项目,我目前正在 Windows 上运行它,如果它有任何相关性的话。
【问题讨论】: