簡體   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