简体   繁体   English

发生异常:错误:ENOENT:没有这样的文件或目录

[英]Exception has occurred: Error: ENOENT: no such file or directory

I am trying to debug my nodejs application but on running javascript debugger, it's showing error.我正在尝试调试我的 nodejs 应用程序,但在运行 javascript 调试器时,它显示错误。

在此处输入图像描述

Here is the package.json file of my project.这是我项目的 package.json 文件。

{
   "name": "server",
   "version": "1.0.0",
   "description": "server side",
   "main": "index.js",
   "scripts": {
     "start": "nodemon index.js",
     "debug": "nodemon --inspect index.js"
   },
   "keywords": [],
   "dependencies": {
     "aws-sdk": "^2.1069.0",
     "bcryptjs": "^2.4.3",
     "body-parser": "^1.19.1",
     "cors": "^2.8.5",
     "dotenv": "^16.0.0",
     "express": "^4.17.2",
     "express-validator": "^6.14.0",
     "jsonwebtoken": "^8.5.1",
     "mongoose": "^6.2.0",
     "multer": "^1.4.4",
     "nodemon": "^2.0.15"
   },
   "devDependencies": {},
   "author": "alkairis",
   "license": "ISC"
}

If you're using VSCode, I recommend to expose a port at inspect like this:如果您使用的是 VSCode,我建议像这样在检查时公开一个端口:

nodemon --inspect=0.0.0.0:9229 index.js

and then you add something like this config to your .vscode/launch.json :然后你将类似这个配置的东西添加到你的.vscode/launch.json

{
              "type": "node",
              "request": "attach",
              "name": "Attach to Remote",
              "restart": true,
              "stopOnEntry": true,
              "port": 9229,
              "address": "0.0.0.0",
              "localRoot": "${workspaceFolder}",
              "sourceMaps": true,
              "protocol": "inspector"
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM