[英]How to use node-inspector with `npm start` for my application?
我正在使用npm start
來啟動我的MEAN堆棧應用程序,但我想使用node-inspector來調試一些Mongoose。 我知道我可以使用node-inspector
啟動節點檢查器,但是我能用什么代替node --debug app.js
來使npm start
在我的情況下npm start
工作?
這是我的MEAN堆棧目錄結構:
HTML views/
Angular.js public/javascript/
Express.js routes/
Node.js app.js
Mongoose js models/, connected in app.js
Mongo db connected in app.js
有關更多信息,這是我的相關問題 。
您可能希望向package.json
添加單獨的debug
腳本。 這樣你就不必記得在完成調試后恢復npm start
。
"scripts": {
"start": "node ./bin/www",
"debug": "node --debug ./bin/www"
}
從npm run
開始:
$ npm run debug
在package.json
修改start
run命令:
"scripts": {
"start": "node --debug app.js"
}
我像這樣使用它,我還設置了一個變量並在一個命令中運行檢查器: npm run debug
"scripts": {
"start": "set SOAPAPI=https://example.com/&&nodemon",
"debug": "start node-inspector --web-port=8081&&set SOAPAPI=https://example.com/&&nodemon --debug"
}
* nodemon是節點的實用程序包裝器,您可以使用node
代替
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.