Tag: PowerShell的

优雅的方法来过滤标准输出内容文件? 或者关掉摩卡的微调?

我正在使用mocha -w进行连续testing。 我遇到了另一个lib的套接字连接的bug,只有在使用mocha -w一段时间才会发生。 我需要捕获指向console.logdebugging输出到一个文件,以便大量的数据可以被search和过滤用于故障排除。 然而,摩卡的“看”微调正在阻碍。 当我尝试使用Windows Power Shell,GitHub的Git Shell或DOS将stdoutredirect到一个文件时: mocha -w >> log.txt 我从animation的微调器中获得这样的数据: [0G [96m | [90m观察[90m观察[0m [90m观察[0m [0G [90m观察[90m观察[90m观察[ [90m观察[90m观察[0m [90m观察[0m [0G [90m观察[90m观察[90m观察[ [90m观察[90m观察[0m [90m观察[0m [0G [90m观察[90m观察[90m观察[ [90m观察[90m观察[0m [90m观察[0m [0G [90m观察[90m观察[90m观察[ [90m观察[0m [0G [96m / [90m观察[0m [0G [96m- 这个SO问题build议制作Mocha的副本,然后play()方法。 然而,通过使用黑客版本的摩卡来尝试排除可能是摩卡缺陷的问题并不理想。 所以现在看来​​是扩展我的shell知识和node.js知识的好时机。 有没有一种优雅的方式来做以下任何事情? 当它们以animation控制字符开始时,过滤掉文件? 防止摩卡渲染微调文本? (似乎没有任何标志, 像这样的文档和bug ,从来没有build议翻转解决scheme的标志)

pipe理文件到uglifyjs – 从Powershell

我想用我的.js文件pipe道uglifyjs使用Windows PowerShell的。 这不会工作: dir .\build -filter *.js | uglifyjs > bundle.js 从uglifyjs2文档我可以看到,uglifyjs需要2个参数: uglifyjs [input files] [options] 我已经了解到,我可以使用pipe道运算符对一个参数进行function修改。 但是, 我应该如何处理2个参数 ? 另外,uglifyjs会将结果写入STDOUT。 这意味着我可以简单地使用>将其写入文件?

重复输出到控制台 – 我必须在哪里插入我的callback?

这是我的代码到目前为止: var databaseUrl = "mydb"; var collections = ["users", "reports"]; var db = require("mongojs").connect(databaseUrl, collections); newuser = { email: "john@example.com", password: "iLoveMongo", sex: "male" }; saveuser = function(user, callback) { db.users.save( user, function( error, saved) { if( error || !saved ) console.log( "User not saved"); else console.log( "User saved" ); callback(); } ); }; removeuser […]

如何解决在TeamCity中创buildFileSet的NAnt错误?

我正在使用TeamCity构build并部署到我们的演示站点。 我们有一个名为HTML Demo Site的configuration,其中一个构build步骤是使用NAnt将HTML部署到网站。 构build文件已经定义了一个目标: <target name="deploy-html" description="Deploys the HTML to the demo server"> <echo message="Deploying HTML to the demo server…"/> <copy todir="\\<server>\<dir>\<client>" includeemptydirs="true" overwrite="true"> <fileset basedir="..\html\_master"> <include name="**\*"/> <exclude name="node_modules\**"/> </fileset> </copy> </target> 每次我在TeamCity上运行构build时,都会失败,出现以下错误: C:\tc\w\9149e011dfa8657d\build_scripts\website.build(27,14): [NAnt output] Error creating FileSet. [NAnt output] The specified path, file name, or both are too long. The fully […]

Azure Node.js Express App scaffold.xml缺失

按照Microsoft的“入门”教程,将Node.js Express应用程序部署为Cloud Service。 在仔细安装两台机器上的所有工具之后,一个Win 7和一个Win 8,我就到了生成“Hello World”的地步,本教程build议在Windows PowerShell中直观地运行名为New-AzureServiceProject的helloworld 。 这是发生了什么事情: PS C:\ node> New-AzureServiceProject helloworld New-AzureServiceProject:找不到path的一部分“C:\ Program Files(x86)\ Microsoft SDK \ Azure \ PowerShell \ ResourceManager \ AzureResourceManager \ AzureRM.Profile \ Resources \ Scaffolding \一般\ scaffold.xml”。 在行:1 char:1 + New-AzureServiceProject expressapp + ~~~~~~~~~~~~~ + CategoryInfo: CloseError:(:) [New-AzureServiceProject],DirectoryNotFoundException + FullyQualifiedErrorId:Microsoft.WindowsAzure.Commands.CloudService.Development.Scaffolding.NewAzureServiceProjectCommand 按照指示安装Powershell和Azure SDK后,看看我的系统,我有一个目录: C:\ Program Files(x86)\ Microsoft […]

NODEJS 发送input到派生进程child.stdin.write();

我在PowerShell中有一组脚本。 我用.HTA构build了一个GUI,但是我正在迁移到一个类似NODE.js的方法。 我有一个工作脚本,但我不得不做一个修改,以解决function丢失从命令行input。 我曾经有CMD提示窗口出现在我会看到所有输出,如果有提示( Read-Host ),用户可以与它交互。 为了解决这个问题,我现在使用[Microsoft.VisualBasic.Interaction]::InputBox()在需要的时候从用户那里获取input。 我尝试使用child.stdin.write(); 因为我的PowerShell进程只是挂起。 它不会回应我的意见。 我已经尝试了我在网上find的每一个答案,没有成功。 生产中调用的脚本是一个长时间运行的过程,具体取决于所选任务,需要20分钟到3小时。 所以,问题是,我不能让child.spawned进程发送input,或者PowerShell不接受来自stdin的input。 感谢您的帮助提前。 码: HTML: <button type="button" id="btn_ExecuteReport">Run Report</button> <button type="button" id="btn_StopReport" >Stop Report</button> <button type="button" id="btn_SendInput" >Send this…</button> <h2>Results:</h2> <p id="result_id">…</p> <br/> JS(使用Electron v 0.31.0,io.js v 3.1.0,jQuery v 1.7.2): $(document).ready(function () { $("#btn_ExecuteReport").click(function (event) { event.stopPropagation(); global.$ = $; var remote = require('remote'); […]

npm install在Windows PowerShell中不起作用

所以我的问题是这个。 我有一个package.json项目。 当我在命令提示符下(cmd.exe)运行“npm install”时,所有的事情都按照预期安装。 然而,当我做PowerShell(powershell.exe)完全相同的东西时,我得到一个错误:“npm ERR!错误:ENOENT,打开'c:\ package.json'”,即使我运行“npm install”该项目。 它总是在c中searchpackage.json:出于某种原因我无法理解。 下面是npm-debug.log(也是写成ic:即使我的path是c:\ code \ myProject): 0 info it worked if it ends with ok 1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe', 1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', 1 verbose cli 'install' ] 2 info using npm@1.3.11 3 info using node@v0.10.21 4 verbose node symlink C:\Program Files\nodejs\\node.exe 5 error install […]

尝试从源文本中的npm – 无法识别的令牌安装Angular 2 Material

我从PowerShell尝试以下命令(以pipe理员身份) npm install @angular2-material 并得到错误: Unrecognized token in source text. At line:1 char:13 + npm install <<<< @angular2-material + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : UnrecognizedToken 我什至尝试只获得一个单一的A2M组件(核心),并得到相同的错误: npm install @angular2-material/{core} 任何想法我做错了什么? npm:3.9.5 节点:6.2.2 操作系统:Win7的 更新: 我在A2M GitHub上发现了以下问题 – 似乎可能是PS的一个问题。 https://github.com/angular/material2/issues/297 更新2: 使用cmd而不是PS工作。

从Node.js执行Powershell脚本

我一直在环视networking和Stackoverflow,但没有find这个问题的答案。 你将如何从Node.js执行Powershell脚本? 该脚本与Node.js实例位于同一台服务器上。

如果在运行程序后损坏了Windows PowerShell的颜色,如何重置颜色?

我开始为使用node.js的Windows项目使用PowerShell。 当从Powershell命令行运行许多程序(包括node,supervisor和npm)时,我的PowerShell背景和前景色开始从默认的Powershell颜色改变。 我如何在PowerShell中保持一致的外观,以便轻松读取运行命令的结果?