execjs

ExecJS coffee script not showing line numbers for compile errors (Rails asset pipeline)

让人想犯罪 __ 提交于 2019-12-03 02:37:14
In one of my Rails apps, ExecJS is not showing line numbers for coffeescript compilation errors. My compile error message will look like this: ExecJS::RuntimeError in Referrals#new Showing ~/MyApp/app/views/layouts/application.html.erb where line #6 raised: SyntaxError: unexpected IDENTIFIER (in ~/MyApp/assets/javascripts/utils.js.coffee) Note that there's no line number for the coffee script source (line #6 is for the erb file). On another one of my apps, where I'm still getting the line numbers, a syntax error looks like this: ExecJS::ProgramError in Projects#show Showing ~/OtherApp/app

Rails 5 Heroku deploy error: ExecJS::ProgramError: SyntaxError: Unexpected token: name (autoRegisterNamespace)

☆樱花仙子☆ 提交于 2019-12-01 02:32:52
When trying to deploy a rails 5 app to heroku, I get the following error, when it reaches Running: rake assets:precompile : remote: ExecJS::ProgramError: SyntaxError: Unexpected token: name (autoRegisterNamespace) (line: 14767, col: 7, pos: 457487) remote: Error remote: at new JS_Parse_Error (<eval>:3623:11948) remote: at js_error (<eval>:3623:12167) remote: at croak (<eval>:3623:21858) remote: at token_error (<eval>:3623:21995) remote: at unexpected (<eval>:3623:22083) remote: at semicolon (<eval>:3623:22601) remote: at simple_statement (<eval>:3623:25779) remote: at <eval>:3623:23567 remote:

TypeError: Object doesn't support this property or method

怎甘沉沦 提交于 2019-11-30 22:21:06
I have created rails application where I created a database (empty). When I try to view my products page, I receive the following error on my http://localhost:3000/products page. Before migrating the database, the application did function. I am using therubyracer and am on Windows 7. ExecJS::ProgramError in Products#index Showing C:/RailsInstaller/DevKit/home/JP/nameofapp/app/views/layouts/application.html.erb where line #16 raised: TypeError: Object doesn't support this property or method (in C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/turbolinks-2.5.3/lib/assets/javascripts

Calling Node.js script from Rails app using ExecJS

て烟熏妆下的殇ゞ 提交于 2019-11-30 18:09:16
I have a Rails application that needs to run a node script. I imagine that using the ExecJS gem is the cleanest way to run JavaScript from a Rails app. However, so far, ExecJS has proved to be very frustrating to use. Here is the script I need to run: // Generated by CoffeeScript 1.7.1 (function() { var PDFDocument, doc, fs; fs = require("fs"); PDFDocument = require('pdfkit'); doc = new PDFDocument; doc.pipe(fs.createWriteStream('output.pdf')); doc.addPage().fontSize(25).text('Here is some vector graphics...', 100, 100); doc.save().moveTo(100, 150).lineTo(100, 250).lineTo(200, 250).fill("

How can I invoke Ruby from Node.js?

笑着哭i 提交于 2019-11-30 13:56:13
问题 There are several ways for running JavaScript inside of a Ruby script. For example, there is ExecJS which is frequently used for porting NPM modules to Ruby. So, is there a "ExecRuby" for Node? 回答1: You can invoke Ruby like any other shell command using child_process.exec() var exec = require("child_process").exec; exec('ruby -e "puts \'Hello from Ruby!\'"', function (err, stdout, stderr) { console.log(stdout); }); Don't know if that's what you're looking for? 来源: https://stackoverflow.com

How can I invoke Ruby from Node.js?

浪子不回头ぞ 提交于 2019-11-30 09:05:18
There are several ways for running JavaScript inside of a Ruby script. For example, there is ExecJS which is frequently used for porting NPM modules to Ruby. So, is there a "ExecRuby" for Node? You can invoke Ruby like any other shell command using child_process.exec() var exec = require("child_process").exec; exec('ruby -e "puts \'Hello from Ruby!\'"', function (err, stdout, stderr) { console.log(stdout); }); Don't know if that's what you're looking for? 来源: https://stackoverflow.com/questions/8101137/how-can-i-invoke-ruby-from-node-js

【项目实战】我是如何从分析到手写一个微信机器人的 - 登录篇

余生颓废 提交于 2019-11-30 07:05:44
相信各位都有在使用微信,并且也知晓web版微信的存在。今天我们就来讲一下,如何通过模拟web版微信接口来制作一个全自动的微信机器人。本篇是该实战项目的第一篇,主讲如何实现一个登陆过程。整个的分析过程实际上是对 https://res.wx.qq.com/a/wx_fed/webwx/res/static/js/index_4f3487a.js 文件的解读🐶。 <!--more--> 0x00逻辑图集 在对一个站点进行逻辑复现前,制作一张逻辑脑图会对整个过程有更好的理解。帮助你理清思路。 图集标注 为了让图像更为整洁,我们将带括号的内容,例如 【verb】 作为一个变量来表示。 并且为了让逻辑路线更为清晰,我们声明如下几类线以区分下一步的操作。 登录逻辑 接下来则是一张通过mindnode画成的网页微信登录过程。 > 其中的session指代该次会话,可以自动处理整个过程中出现的set-cookie事件。 0x01过程分解 而后我们将web微信的登录过程划分成以下几个步骤。 1.打开web微信首页 2.扫描二维码 3.模拟扫描及确认过程 4.完成登录 5.登录后的信息获取 0x02过程详解 1.打开web微信首页 首先我们需要获取到二维码以用于扫描。通过观察web请求过程我们发现, https://login.weixin.qq.com/qrcode/【xxx】 为其实际地址。而

【项目实战】我是如何从分析到手写一个微信机器人的 - 登录篇

烂漫一生 提交于 2019-11-30 03:47:06
相信各位都有在使用微信,并且也知晓web版微信的存在。今天我们就来讲一下,如何通过模拟web版微信接口来制作一个全自动的微信机器人。本篇是该实战项目的第一篇,主讲如何实现一个登陆过程。整个的分析过程实际上是对 https://res.wx.qq.com/a/wx_fed/webwx/res/static/js/index_4f3487a.js 文件的解读🐶。 <!--more--> 0x00逻辑图集 在对一个站点进行逻辑复现前,制作一张逻辑脑图会对整个过程有更好的理解。帮助你理清思路。 图集标注 为了让图像更为整洁,我们将带括号的内容,例如 【verb】 作为一个变量来表示。 并且为了让逻辑路线更为清晰,我们声明如下几类线以区分下一步的操作。 登录逻辑 接下来则是一张通过mindnode画成的网页微信登录过程。 > 其中的session指代该次会话,可以自动处理整个过程中出现的set-cookie事件。 0x01过程分解 而后我们将web微信的登录过程划分成以下几个步骤。 1.打开web微信首页 2.扫描二维码 3.模拟扫描及确认过程 4.完成登录 5.登录后的信息获取 0x02过程详解 1.打开web微信首页 首先我们需要获取到二维码以用于扫描。通过观察web请求过程我们发现, https://login.weixin.qq.com/qrcode/【xxx】 为其实际地址。而

execJs: 'Could not find a JavaScript runtime' but execjs AND therubyracer are in Gemfile

≯℡__Kan透↙ 提交于 2019-11-28 02:48:34
I'm getting this error: rake aborted! Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs , I have already spent more hours searching google then I am willing to admit. I believe this is an execJs bug. From all the posts, this is a very common issue with rails 3.1. A js runtime is now needed by what are now standard gems like coffee-script and sass. Most of these cases were resolved by adding the gems 'execjs' and 'therubyracer' to the app Gemfile, and then running 'bundle update' and/or 'bundle install'. But not for me. I guess I got lucky. I am running rails 3.1.3

Node.js not found by Rails / execjs

送分小仙女□ 提交于 2019-11-28 00:19:25
I have node.js installed by compiling and installing it from the root user. I think this maybe where the hangup is. From the user running the rails app I checked for node.js. $ which node /usr/local/bin/node When I launched my rails app (Rails 3.2.9) I get the universally unhelpful "We're sorry, but something went wrong." Checking the the production error log I saw that the Javascript runtime was not found. That's confusing as it is obviously installed. So I went about forcing the Node javascript runtime. I edited config/boot.rb to include: ENV['EXECJS_RUNTIME'] = 'Node' I checked my app again