[英]Hi, I get this bug here Error: Cannot find module 'debug'
也許我在package.json
上刪除了一些東西,但我又寫了一遍(我沒有卸載)我得到了這個錯誤:
Error: Cannot find module 'debug'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
at Function.Module._load (internal/modules/cjs/loader.js:529:25)
at Module.require (internal/modules/cjs/loader.js:658:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (C:\Users\Leo\fase2\node_modules\nodemon\lib\nodemon.js:1:75)
at Module._compile (internal/modules/cjs/loader.js:722:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:733:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
error Command failed with exit code 1.
我搞不清楚了!! 是什么導致了問題?
您的 node_modules 中似乎缺少debug
模塊。 npm install debug --save
將解決這個問題,它還會在 package.json 中為包創建一個條目。 有關更多信息,請查看官方文檔
這可能是您本地 node_modules 目錄的問題。 我建議刪除並重新安裝它。 然后檢查您的本地依賴項以查看是否再次包含調試。
在嘗試以下操作之前,請確保您位於項目文件夾中!
為此,請刪除文件夾node_modules
並使用npm install debug
重新安裝。 如果此操作失敗,您可以檢查創建的日志中是否存在安裝期間發生的任何特定錯誤。
僅供參考,我收到此錯誤是因為我將 start.js 移到了node_modules
的文件夾node_modules
(將代碼分成兩個不同的項目)。
我以為我可以使用node ../start.js
啟動服務器,也許我可以進行更多調試,但是我將所有代碼移回了包含 package.json 和node_modules
的文件夾樹中修復。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.