[英]nodemon command is not recognized in terminal for node js server
[英]nodemon command not recognized by terminal
我正在嘗試使用 nodemon 自動重新加載服務器。 我已在本地安裝它並將開始設置為
nodemon app.js
使用代碼:
"scripts": { "start": "nodemon app.js" }
第一次運行良好,但關閉系統一次並重新打開我的項目后,它似乎不再正常運行。 現在每次我使用命令nodemon app.js
都會引發錯誤。
錯誤行是:
nodemon: The term 'nodemon' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
我可以解決的最佳解決方案是:
npm install -D nodemon // install as a dev dependency
npm start // run script start
下面是一些解決方案
npm install -g nodemon
之后你必須運行這個命令: npm run dev
here dev is (script) server name
npm config get prefix
在 output 中,您將獲得 PATH ,然后通過此路徑進入環境變量並解決
重新啟動終端並運行此命令
nodemon run dev
我希望之后它會正常工作:)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.