繁体   English   中英

Ruby on Rails“(”意外出现语法错误

[英]Syntax Error for Ruby on Rails “(” unexpected

导轨-v

激活以上命令将导致:

bin / rails:7:bin / rails:语法错误:“(”意外

我的引擎导轨似乎无法正常运行,并且没有响应。

当我尝试调用rails -v或rails db:create之类的内容时,它会告诉您语法错误。

rails返回相同的错误

这是我使用的.gemspec文件的其余部分:

# frozen_string_literal: true

$:.push File.expand_path('lib', __dir__)

# Maintain your gem's version:
require 'vulnerabilities/version'

# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
  s.name        = 'vulnerabilities'
  s.version     = Vulnerabilities::VERSION
  s.authors     = ['Evgeny Karpenko']
  s.email       = ['e.karpenko@isoit.ru']
  s.homepage    = 'https://new.docshell.ru'
  s.summary     = 'Vulnerabilities Plugin for Docshell4'
  s.description = 'VulnerabilitiesPlugin for Docshell4'
  s.license     = 'proprietary'

  s.files = Dir['{app,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.md']

  s.add_dependency 'rails', '~> 5.1.6', '>= 5.1.6.1'

  s.add_dependency 'active_model_serializers', '~> 0.10.7'
  s.add_dependency 'kaminari', '~> 1.1', '>= 1.1.1'
  s.add_dependency 'pg', '~> 1.1', '>= 1.1.2'
  s.add_dependency 'swagger-blocks', '~> 2.0.2'
  s.add_dependency 'rest-client', '~> 2.0', '>= 2.0.2'

  s.add_development_dependency 'annotate'
  s.add_development_dependency 'database_cleaner'
  s.add_development_dependency 'factory_bot_rails'
  s.add_development_dependency 'faker'
  s.add_development_dependency 'rspec'
  s.add_development_dependency 'rspec-instrumentation-matcher'
  s.add_development_dependency 'rspec-rails'
  s.add_development_dependency 'shoulda-matchers'
end

这是bin / rails文件,无法运行File.expand_path

# frozen_string_literal: true

#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails gems
# installed from the root of your application.

ENGINE_ROOT = File.expand_path('..', __dir__)
ENGINE_PATH = File.expand_path('../lib/vulnerabilities/engine', __dir__)
APP_PATH = File.expand_path('../spec/dummy/config/application', __dir__)

# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])

require 'rails/all'
require 'rails/engine/commands'

原因在于:

# frozen_string_literal: true

卸下后-滑轨开始正常工作

这条线是由于RuboCop的干预而出现的

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM