“属性‘程序’不存在"用于基本的 node.js 项目 [英] "Attribute 'program' does not exist" for basic node.js project
本文介绍了“属性‘程序’不存在"用于基本的 node.js 项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了简单的 node.js 应用程序(来自这里的源代码 https://azure.microsoft.com/en-us/blog/visual-studio-code-and-azure-app-service-a-perfect-fit/)
I created simple node.js application (source code from here 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);
然后点击VSCode生成的launch.json:
And clicked VSCode generated 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
}
]
}
仍然在启动时我看到:
属性程序"不存在.
有人可以帮忙吗?
推荐答案
我相信你需要的是 ${workspaceRoot}/server.js
,而不是 ${workspaceRoot}/app.js
用于程序
.您使用的代码没有 app.js,这就是(措辞不佳)错误告诉您的.
I believe that you need ${workspaceRoot}/server.js
, not ${workspaceRoot}/app.js
for program
. The code you're using doesn't have an app.js, that's what that (poorly worded) error is telling you.
这篇关于“属性‘程序’不存在"用于基本的 node.js 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文