Tag: visual studio code

防止控制台closuresexception

我尝试了Visual Studio代码(在Windows上),并喜欢它到目前为止。 有没有办法阻止控制台/terminal在debugging节点应用时自动closures未处理的exception? 我知道节点退出是正确的行为,我只是有机会在closures控制台窗口之前阅读输出。

VSCodedebugging不适用于NodeJs应用程序

我已经在launch.json文件中添加了以下详细信息的configuration: { "name": "Attach" "type": "node", // TCP/IP address. Default is "localhost". "address": "localhost", // Port to attach to. "port": 5858 } 现在我使用以下命令启动我的应用程序: node –debug-brk ./bin/www 当我去VSCode并selectAttach在顶部的debugging菜单,并点击播放button。 它附加,但是当我去浏览器并打开一个页面,它不是它在我的index.js文件中的断点或处理函数。 你能帮我解决一下错误吗?

Visual Studio代码debugging客户端JavaScript

我正在使用Visual Studio代码为一个JavaScript项目。 您可以设置断点,并轻松地debugging在nodejs中运行的代码。 有没有办法允许客户端,浏览器运行代码的断点和debugging? 通过console.log进行debugging变得很快。

结合Visual Studio代码构build任务

Visual Studio代码文档提供了示例tasks.jsonconfiguration ,允许打字稿编译或降价编辑。 它并没有阐明如何同时实现两者 。 如何做到这一点? 这是两个例子的总结 打字稿例子 如果我希望VSCode执行打印脚本构build步骤,说明我需要安装打字稿( npm install -g typescript打印脚本),然后定义以下任务: { "version": "0.1.0", "command": "tsc", "isShellCommand": true, "showOutput": "silent", "args": ["*.ts"], "problemMatcher": "$tsc" } Markdown示例 如果我希望VSCode执行Markdown构build步骤,文档说我可以安装我select的markdown插件(例如npm install -g marked ),然后定义一个任务: { "version": "0.1.0", "command": "marked", "isShellCommand": true, "args": ["sample.md", "-o", "sample.html"] } 怎么办? 显然,tasks.json可能只包含一个JSON对象。 因此,我不能简单地用逗号将上述两个定义join。 另一方面,可以在整个任务定义中定义多个任务: { "version": "0.1.0", "command": "<what goes […]

无法在Visual Studio代码中debugging无服务器应用程序

我曾尝试debugging在VS代码中使用无服务器框架开发的无服务器应用程序。 我跟着这篇文章。 但是当我试图debugging代码时,我得到了如下VS代码的错误。 无法启动程序'g:\ Projects \ Serverless1 \ node_modules.bin \ sls'; 设置'outDir或outFiles'属性可能会有所帮助。 sls命令文件已经存在于该文件夹中,以下是launch.json文件设置 "version": "0.2.0", "configurations": [ { "type": "node", "request": "launch", "protocol": "inspector", "name": "run hello function", "program": "${workspaceRoot}\\node_modules\\.bin\\sls", "args": [ "invoke", "local", "-f", "hello", "–data", "{}" ] } ] 请帮我解决这个问题。

在JavaScript VSCode项目中添加自定义的types文件

项目介绍 我正在使用VSCode的电子项目 我使用npm install electron electron.d.ts文件当时是空的,所以我只复制了电子types文件并粘贴在那里,然后,电子intellisense工作正常。 问题 我也想为我的一些自定义的JavaScript对象添加另外一些types的接口声明文件 declare namespace ProjectName { interface Item { property?: string; name: string; } } 但我找不到一种方法将我的projectname.d.ts文件加载到VSCode intellisense。 我试过了 我尝试使用typings install "projectname.d.ts" ,它创build了typings.json文件夹, typings.json等。这只是在打开VSCode中的打字文件,然后closures并重新打开应用程序后才工作。 这只有当我打开typings文件的时候才起作用。 这不是添加我的接口声明的一个非常方便的方法。 由于VSCode正在加载electron.d.ts文件,我想只是在该文件的底部添加我的自定义命名空间。 这个“黑客”按预期工作,但我不认为这是解决这个问题的正确方法。 此外,由于VSCode可以读取电子types文件,因此应该可以加载新的types文件。 关于VSCode Version: 1.17.0 Shell: 1.7.7 Node: 7.9.0 Architecture: x64

debuggingVSCode中的CoffeeScript将转到.js文件

我正在尝试在vs代码中debuggingCoffeeScript文件。 它的工作原理,我可以通过compiled.js文件。 但是,我无法通过实际的CoffeeScript文件。 这是我的launch.json文件: { "type": "node", "request": "launch", "name": "Launch Meeting", "program": "${workspaceRoot}/lib/meeting/meeting-service.coffee", "cwd": "${workspaceRoot}", "env": { "NODE_ENV": "local" }, "sourceMaps": true } 而在另一个窗口,我正在运行: ./node_modules/.bin/coffee -mc –watch lib/activity/note-activity-model.coffee \ lib/activity/note-activity-publisher.coffee \ lib/app-event-queue.coffee \ lib/meeting/meeting-api.coffee \ lib/meeting/meeting-service.coffee \ lib/meeting/meeting-socket-service.coffee \ lib/meeting/meeting-util.coffee 当我在咖啡文件中设置断点时,debugging器在编译后的js文件上暂停。 我在咖啡文件上需要它。

我如何debuggingVSCode中运行PM2的Node.js应用程序?

Visual Studio代码中内置了一些非常棒的debuggingfunction,可以方便地debugging带有节点的应用程序。 但是,我的应用程序被configuration为使用PM​​2。 如何设置Visual Studio代码来debuggingPM2?

使用Visual Studio代码远程debuggingDocker中的NodeJS

我想为我的应用程序使用官方node泊坞窗图像。 但是我不能让远程debugging器在主机上工作。 我正在使用Visual Studio代码连接到远程debugging器。 奇怪的是使用非官方的图像cusspvz/node远程debugging工作正常。 当我运行docker log对容器的cusspvz/node实例时,我得到以下输出: Debugger listening on [::]:5858 但是,当我运行docker log对容器的node实例我得到: Debugger listening on 127.0.0.1:5858 这导致我相信debugging器正在监听错误的IP地址(应该是通配符而不是本地主机?) 我已经尝试了内置debugging器以及nodemon。 不幸的是,我无法让节点检查器工作,因为它无法安装(看来,构build失败了)。 这是我的Dockerfile: FROM node WORKDIR /scraper EXPOSE 5858 ENTRYPOINT ["/bin/bash", "-c", "if [ -z \"$REMOTE_DEBUGGING\" ]; then node –debug index.js; else node –debug-brk index.js; fi"] COPY . /scraper RUN npm install 我用docker-compose启动容器,使用这个YML文件: version: '2' services: alt.nphotos.imagescraper: […]

为什么createServer()被认为不是一个函数?

我安装了快递全球和npm安装了我的快递应用程序,但intellisence或应用程序都没有工作(我在Mac OS Yosemite上使用Visual Studio代码)。 这里是一个示例代码: /// <reference path="typings/node/node.d.ts" /> /// <reference path="typings/express/express.d.ts" /> var express = require('express'); var app = express.createServer(); app.get('/', function (req, res) { res.send('hi'); }) app.listen(8000); 这里是我得到的错误: Abeds-MacBook-Pro:myNode AZ$ node twitter.js /Users/AZ/Desktop/myNode/twitter.js:5 var app = express.createServer(); ^ TypeError: express.createServer is not a function at Object.<anonymous> (/Users/AZ/Desktop/myNode/twitter.js:5:19) at Module._compile (module.js:397:26) at Object.Module._extensions..js (module.js:404:10) […]