在使用Typescript构建节点项目时无法运行Nodemon(在Windows中)。

问题描述 投票:0回答:1

Node项目的构建是以 手稿 在package.json文件中有三个脚本,但当我运行时,它显示... ...

如果我把这个项目运行在 ubuntu 它工作正常,但不是在 窗口

输出终端的形象

但在这之后,nodemon并没有开始运行项目。

包裹.json中的脚本

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

帮我解决这个问题,先谢谢你:)

node.js typescript server build nodemon
1个回答
5
投票

你似乎缺少一个 & 间字 tsc --watchnodemon dist/index.js. 单一 & 是无效的 and 运营商。

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

更新 看来问题出在Windows上。通常这个问题可以通过使用concurrently或cross-env等库来解决,在Windows上以类似的方式执行命令。在你安装了concurrently之后。

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

希望能帮到你

© www.soinside.com 2019 - 2024. All rights reserved.