标识符'(function(opts,pluginOpts){返回eval(process)未定义-Home#index中的ExecJS :: ProgramError

时间:2018-07-16 06:36:59

标签: ruby-on-rails puma react-rails

我是react / rails方面的初学者。现在,我必须立即构建应用程序。我收到一个我不熟悉的错误。我已经做了很多工作。

最后,我在堆栈溢出中。因为我知道我们这里有可以帮助我的人。

这是错误: https://i.stack.imgur.com/pOSNc.jpg

这是gemfile。

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.4.3'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.0'
# Use sqlite3 as the database for Active Record
# gem 'pg','~> 0.20.0'
gem 'pg'
# Use Puma as the app server
gem 'puma', '~> 3.11'
gem 'bootstrap', '~> 4.1.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
gem 'duktape'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
gem 'webpacker'
gem 'react-rails'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.1.0', require: false

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 3.3.0'
end

group :test do
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '>= 2.15', '< 4.0'
  gem 'selenium-webdriver'
  # Easy installation and use of chromedriver to run system tests with Chrome
  gem 'chromedriver-helper'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

这是一个React js文件

import React from 'react';
import PropTypes from 'prop-types';

class GreetUser extends React.Component{
  constructor(props, context) {
     super(props, context);
     this.state = { 
        name: props.name,
     };
  }
  componentDidMount(){}
  render() {
     return (
        <div>
           <h1>Hello: {this.state.name}</h1>
        </div>
     )
  }
}
  GreetUser.PropTypes = {
    name: PropTypes.string
  }

export default GreetUser;

这是我要导入的文件。

<%= react_component 'GreetUser', name: 'Ankur' %>

这是application.html.erb

<!DOCTYPE html>
<html>
<head>
  <title>Workspace</title>
  <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
  <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
  <!-- Following will make the react components availabe to our layout -->
  <%= javascript_pack_tag 'application' %>
  <%= csrf_meta_tags %>
</head>
<body>

<%= yield %>

</body>
</html>

这是服务器上的日志:

ActionView::Template::Error (identifier '(function(opts, pluginOpts)
{return eval(process' undefined):
    4:   <title>Workspace</title>
    5:   <%= csrf_meta_tags %>
    6:   <%= csp_meta_tag %>
    7:   <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => 'reload' %>
    8:   <%= javascript_include_tag 'application', 'data-turbolinks-track' => 'reload' %>rack' => 'reload' %>                                                 r layout -->
    9:   <!-- Following will make the react components availabe to our layout -->
   10:   <%= javascript_pack_tag 'application' %>
                                                                     cation_html_erb___1525250716_125679800'
(execjs):1
app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb___1525250716_125679800'

1 个答案:

答案 0 :(得分:0)

尝试删除 duktape gem并安装node.js