草庐IT

DEBUG_MODE

全部标签

javascript - 启动时打开 Karma debug.html 页面

简短版:如何启动Karma并让它在与Karma起始页相同的浏览器中自动打开debug.html文件?长版:我不太喜欢使用控制台报告器来记录Karma,所以我一直在使用karma-jasmine-html-reporter-livereload输出到Karma的localhost:9876/debug.html文件。问题是,每次我开始调试session时,我都必须单击karma打开的网页中的“调试”按钮。我想找到一种方法让karma通过gulp任务自动打开debug.html页面。我在多个浏览器中运行测试,因此我希望debug.html页面在Karma打开的每个浏览器中作为第二个选项卡打

javascript - 为什么 Chrome 在 "strict mode"中使用 block 内的函数时仍然保持沉默?

这个问题在这里已经有了答案:Doesstrictmodeprohibitstatementlevelfunctiondeclarations?(1个回答)关闭6年前。我对JS“严格模式”;很陌生,当我使用如下代码时:functionouter(){"usestrict";varctype;functioninner(){if(ctype!=undefined){functionhello1(){console.log("hello1");}hello1()}else{functionhello2(){console.log("hello2");}hello2();}}returninn

node.js - python -i : run and enter interactive mode?的node.js模拟是什么

在python中有一个很好的特性,python-i。比如python-imyprogram.py会运行程序然后进入交互模式,就好像我把整个程序粘贴到了交互shell中一样。node.js中有类似的命令吗? 最佳答案 文档位于https://nodejs.org/api/cli.html-r,--requiremodulePreloadthespecifiedmoduleatstartup.Followsrequire()'smoduleresolutionrules.modulemaybeeitherapathtoafile,ora

javascript - "Cannot switch to old mode now"- tls.connect 函数中的 Node.JS apn 模块错误

我正在尝试实现Node.JSapn模块以连接到APNS(Apple推送通知服务),以便从运行Ubuntu12.04的AmazonEC2实例上托管的Node服务器(使用ExpressJS)向iPhone设备推送通知。我收到此错误:"Error:Cannotswitchtooldmodenow.","atemitDataEvents(_stream_readable.js:720:11)","atReadStream.Readable.resume(_stream_readable.js:705:3)","atTLSSocket.(/home/ubuntu/usemebeta/routes

node.js - 在 webpack.config.js 中获取当前的 `--mode`

如何在webpack.config.js中获取package.json中指定的当前--mode?(例如,用于推送一些插件。)package.json"scripts":{"dev":"webpack--modedevelopment","build":"webpack--modeproduction"}我在Webpack3中做了什么:package.json"scripts":{"build":"cross-envNODE_ENV=developmentwebpack","prod":"cross-envNODE_ENV=productionwebpack"},然后,我可以通过proc

javascript - 我可以告诉浏览器同步始终使用一个 .html 文件吗? (对于 html5mode 链接)

我在我的gulp文件中使用浏览器同步(https://github.com/shakyShane/browser-sync)用于开发目的。我想在我的Angular应用程序中使用html5mode。对于该服务器需要将多个url模式路由到单个html文件。暂存和生产服务器已经这样做了,但我也希望在开发过程中启动并运行它。这是我如何运行browser-sync服务器(gulpfile.js的一部分):gulp.task('serve',function(){browserSync.init(null,{server:{baseDir:[APP_PATH]}});//watchonlyfora

javascript - 将 AngularJS html5mode 与 nodeJS 和 Express 一起使用

我正在使用带有Express的nodeJS服务器来为我的AngularJS应用程序提供服务。当我使用angularJS默认路由(hashbangs)时,这一切都很好,但现在我正在尝试激活html5模式。我正在像这样激活html5mode:$locationProvider.html5Mode(true).hashPrefix('!');这就是我的nodeJSapp.js文件的样子:varpath=require('path'),express=require('express'),app=express(),routes=require(path.join(__dirname,'rou

node.js - Chrome 73 : Can no longer debug NodeJS with Dedicated DevTools for Node

我刚刚将我的Chrome升级到73.0.3683.75(Linux),现在无法让我的专用Node调试器实际调试正在运行的实例。即使我可以在控制台中看到“附加调试器”消息:$node--inspect-brkhello.jsDebuggerlisteningonws://127.0.0.1:9229/864a1c18-5e45-49ab-843c-77a22841ffffForhelp,see:https://nodejs.org/en/docs/inspectorDebuggerattached.调试器窗口不显示任何调试目标的迹象:任何人都知道这在Chrome73中是否被破坏或者我做错

debugging - 如何以编程方式检测nodejs中的 Debug模式?

我看到有人问过其他平台/语言的这个问题-有什么想法吗?我想做类似的事情:if(detectDebug()){require('tty').setRawMode(true);varstdin=process.openStdin();stdin.on('keypress',function(chunk,key){DoWork();}}else{DoWork();}我希望能够在调试时切换键盘输入作为脚本的开始,这样我就可以有时间启动chrome来监听我的Node检查器端口。***快速更新-我猜我实际上可以使用“process.argv”来检测是否传入了--debug。这是最好/正确的方法吗?

node.js - 如何使用 createWriteStream 避免 "Octal literals are not allowed in strict mode"

我有以下代码fs.createWriteStream(fileName,{flags:'a',encoding:'utf8',mode:0644});我收到一个lint错误Octalliteralsarenotallowedinstrictmode.执行此代码的正确方法是什么,这样我就不会收到lint错误? 最佳答案 我在景观序列中使用它时遇到了这个问题:console.log('\033c');//Clearscreen我所要做的就是将它转换为十六进制console.log('\x1Bc');//Clearscreen