Val*_*riy 67 node.js visual-studio-code
我创建了简单的node.js应用程序(源代码来自https://azure.microsoft.com/en-us/blog/visual-studio-code-and-azure-app-service-a-perfect-fit/)
var http = require('http');
http.createServer(function (req, res) {
console.log('Got request for ' + req.url);
res.writeHead(200, {'Content-Type': 'text/html'});
res.end('<h1>Hello Code and Azure Web Apps!</h1>');
}).listen(process.env.PORT);
Run Code Online (Sandbox Code Playgroud)
然后点击VSCode生成的launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/app.js",
"stopOnEntry": false,
"args": [],
"cwd": "${workspaceRoot}",
"preLaunchTask": null,
"runtimeExecutable": null,
"runtimeArgs": [
"--nolazy"
],
"env": {
"NODE_ENV": "development"
},
"externalConsole": false,
"sourceMaps": false,
"outDir": null
},
{
"name": "Attach",
"type": "node",
"request": "attach",
"port": 5858,
"address": "localhost",
"restart": false,
"sourceMaps": false,
"outDir": null,
"localRoot": "${workspaceRoot}",
"remoteRoot": null
}
]
}
Run Code Online (Sandbox Code Playgroud)
仍然在推出时我看到:
属性"程序"不存在.
任何人都能帮助解决问题吗?
mdi*_*kin 64
我认为你需要${workspaceRoot}/server.js,而不是${workspaceRoot}/app.js为program.您正在使用的代码没有app.js,这就是(措辞不当)错误告诉您的内容.
小智 23
我也遇到过这个问题,因为VS Code放置了包含launch.json文件的.vscode目录.它把它放在一个目录中,所以我必须将目录添加到launch.json文件中定义的路径:
"program":"$ {workspaceRoot} /myDir/app.js",
我希望这有帮助.
| 归档时间: |
|
| 查看次数: |
53945 次 |
| 最近记录: |