Tag: visual studio code

visual studio code nodejs request'launch':无法启动目标(原因:spawn节点ENOENT)

当我使用visual studio代码来debuggingnodejs应用程序。 视觉工作室代码告诉我request 'launch': cannot launch target (reason: spawn node ENOENT) 我的nodejs版本是4.2.4

找不到模块dtrace-provider

我有一个简单的nodejs应用程序抛出"Cannot find module './build/Release/DTraceProviderBindings'" 。 我在网上查找它,看起来像很多人在Windows上使用restify(这是我的情况,我在Windows 10上使用restify)有同样的问题。 显然, dtrace-provider是一个可选模块,用于调整 ,没有Windows的版本。 所以,我到目前为止的尝试: 更新节点到v6.2.0; 卸载所有模块并运行npm install –no-optional ; 只卸载restify并运行npm install restify –no-optional ; 而我最绝望的举动npm install dtrace-provider 。 我在github问题上发现的所有东西,我发现OSX用户和其他模块有相同的错误。 不知道还有什么要尝试。 注意:这个exception不会停止我的应用程序,甚至不会在控制台上打印错误,我只是注意到这是使用debugging器发生的,换句话说,我的应用程序运行正常,但是这种情况在后台继续发生。 我正在使用的其他模块列表: "dependencies": { "restify": "latest", "request": ">=2.11.1", "cheerio": ">=0.10.0", "xml2js": ">=0.2.0", "botbuilder": "^0.11.1", "applicationinsights": "latest" }

如何使用TypeScript 1.6与Visual Studio代码来获得生成器的支持?

我一直在Visual Studio Code中定位ES6,但是当我尝试切换到TypeScript时,它会抛出如下错误: 生成器仅在定位ECMAScript 6时可用 但是我的tsconfig.json确实有ES6目标: { "compilerOptions": { "target": "ES6", "module": "amd", "sourceMap": true } } 所以我试了npm install -g typescript@1.6.0-beta typescript@1.6.0-beta,但是看起来VSCode并不在意。 发电机目前不支持。 我怎样才能让TypeScript和生成器在VS Code中一起正常工作? 更新 将typescript.tsdk更改为1.6二进制文件似乎可以修复IntelliSense错误,但是这个tasks.json仍然会打印出error TS1220: Generators are only available when targeting ECMAScript 6 or higher. : "version": "0.1.0", "command": "/usr/local/lib/node_modules/typescript/bin/tsc", "showOutput": "silent", "windows": {"command": "tsc.exe"}, "isShellCommand": true, "args": ["app.ts"], "problemMatcher": "$tsc" 但是,在terminal中手动使用的/usr/local/lib/node_modules/typescript/bin/tsc […]

为什么for-of-loop还没有完成运行,跳出来运行console.log?

运行环境 Visual Studio Code v1.15.1自己编译 Node.js v8.2.1 操作系统:Windows 10 描述 我想在源代码和sorting之间添加“sorting后”,如下所示: 但是控制台偶尔会显示: 为什么for-of-loop还没有完成运行,跳出来运行console.log? 源代码: // Random to generate double digits. function getRandom() { return Math.round(Math.random() * 100); } // Writing data to the array. var score = [ ["a", getRandom()], ["b", getRandom()], ["c", getRandom()], ["d", getRandom()], ["e", getRandom()] ]; console.log("Before sort:"); // Print source arry […]

使用Coffee脚本的Visual Studio代码和Node.js

我有一个旧的node.js项目,我想用来试用VSCode。 我通常通过从命令行运行“coffee app.coffee”来运行它。 我configuration了我的launch.json文件,但VSCode运行“node app.coffee”。 我怎么能告诉它使用咖啡,而不是节点? 干杯 聂

如何将VS代码附加到在泊坞窗容器中运行的节点进程

我试图将Visual Studio代码debugging器附加到在Docker容器内运行的node.js应用程序。 我开始像这样的应用程序: node –debug-brk app.js 我在docker-compose.yml公开debugging器端口: app: build: . working_dir: /code volumes: – .:/code command: npm run debug ports: – "3004:3000" – "5858:5858" 我的launch.json如下所示: { "version": "0.1.0", "configurations": [ { "name": "Attach", "type": "node", "address": "localhost", "port": 5858 } ] } 现在,当我启动应用程序并附加debugging器,这将正确连接(我可以看到在debugging器用户界面中闪烁的值),但它会停止,告诉我以下内容: Error opening 'app.js' (File not found: /code/app.js). 这是因为docker-compose.yml不会在root中挂载应用程序,而是在/code (请参阅docker-compose.yml volumes ),VS代码被突然偏移所困扰。 当我运行应用程序之外的容器(即本地,没有偏移量),它的工作方式和预期的一样,我可以按照预期使用debugging器。 […]

debuggingNode.JS VS代码EADDRINUSE错误

我试图在VS代码上debugging一个Node.JS应用程序,但是当terminal打开时,我得到这个消息: 错误:听EADDRINUSE ::: 5858 我的应用程序使用了一个名为StrawJS的框架( https://github.com/simonswain/straw ),它同时启动了一些不同的进程。 我认为这是错误的原因,因为有许多不同的进程试图使用相同的debugging器。 我发现了一个类似的问题( VSCode不会停止在第一个节点prcess分叉一秒的断点上 ),但configurationattach.js文件的端口不起作用,问题依然存在。 这是我的实际launch.json文件: { "version": "0.2.0", "configurations": [ { "name": "Launch", "type": "node", "request": "launch", "port": 5858, "program": "${workspaceRoot}/run.js", "stopOnEntry": false, "args": [], "cwd": "${workspaceRoot}", "preLaunchTask": null, "runtimeExecutable": null, "runtimeArgs": [ "–nolazy" ], "env": { "NODE_ENV": "development" }, "externalConsole": true, "sourceMaps": false, "outDir": null } ]} […]

如何在TypeScript中正确地要求和声明节点库types?

我正在尝试使用标准节点库(例如fs , path , stream , http在TypeScript中为节点编写一个包。 当我尝试在.ts文件中导入库时,VS Code标记相应的行并出现错误: [ts] Cannot find module 'fs' 。 无论如何尝试导入库,都会发生这种情况: import * as fs from 'fs'; // [ts] Cannot find module 'fs' import fs = require('fs'); // [ts] Cannot find module 'fs' const fs = require('fs'); // [ts] Cannot find name 'require' 我(应该)有安装正确的定义安装 – typings install –save –ambient node […]

VSCode 0.3无法findpath上的运行时节点

我刚刚从0.1的vscode升级到0.3。 现在,当我运行debugging器“在path上找不到运行时节点”时出现错误。 我有在OSX 10.10.3上运行的iojs v2.3.0。 我使用nvm安装iojs,所以有可能节点不在path中,但是我可以在terminalinput“node”并获得一个repl。

在Visual Studio代码中使用“preLaunchTasks”和命名任务

根据文档 ,在debugging之前可以启动一个程序: 要在每个debugging会话开始之前启动任务,请将preLaunchTask设置为preLaunchTask中指定的其中一个任务的名称 。 我没有看到“命名”任务的示例语法,但架构文档显示了一个名为taskName的属性。 我试图使用它将我的launch.json preLaunchTasks链接到该任务,但它不起作用。 当我启动我的程序时,Visual Studio Code报告了这个错误: 无法find一个独特的任务“发射核心”。 确保任务存在,并且具有唯一的名称。 我的自定义“命名”任务是这样的: { "taskName": "launch-core", "version": "0.1.0", "command": "C:\\utils\\mystuff.exe", // The command is a shell script "isShellCommand": true, // Show the output window only if unrecognized errors occur. "showOutput": "silent", } 然后我尝试改变属性名称从taskName到name , 基于这个链接 。 这也没有奏效。 智能感知不提供如何命名任务的build议。 有谁知道如何在tasks.json文件中唯一命名一个任务? 什么是语法? 什么是属性名称? 最终,我想在自己的node.js应用程序启动之前执行两个或三个node.js进程。 例如,我希望在应用程序启动到debugging器之前启动以下三个应用程序: sh -c […]